Let me show you a magic trick debit/credit cards:
Take out your debit/credit card, and see the digits (For example ๐ฐ๐ฌ๐ฌ๐ฌ ๐ฌ๐ฌ๐ญ๐ฎ ๐ฏ๐ฐ๐ฑ๐ฒ ๐ณ๐ด๐ต๐ต)
Start from the first digit, multiply it by 2 and repeat this process for all digits which are at odd positions. So, after calculation, you would be seeing them like (๐ด-0-๐ฌ-0 ๐ฌ-0-๐ฎ-2 ๐ฒ-4-๐ญ๐ฌ-6 ๐ญ๐ฐ-8-๐ญ๐ด-9)
By this time, you might have noticed that some numbers after multiplication resulted in a 2-digit number. So, for such 2-digits numbers, add both of their digits to generate a single-digit number.
After this stage, your numbers would be like (8-0-0-0 0-0-2-2 6-4-๐ญ-6 ๐ฑ-8-๐ต-9)
Now, you have to just add all these digits together, the sum for my example would be: 8+0+0+0+0+0+2+2+6+4+1+6+5+8+9+9=60
This resultant sum would be always divisible by 10 if your debit/credit card number is valid.
This is not a magic trick, but Luhn's Algorithm/Checksum, which is used to validate your input number by card-issuing authorities.
Luhn Algorithm makes it possible to check numbers (Credit card, debit card, SIRET, etc.) thanks to its control key. If a character is misread or badly written, then Luhn's algorithm will detect this error.
Luhn Algorithm is known because MasterCard, American Express (AMEX), Visa, RuPay card and all other credit/debit cards use it.
The algorithm is in the public domain and is in wide use today. It is not intended to be a cryptographically secure hash function; it was designed to protect against accidental errors, not malicious attacks. Most credit cards and many government identification numbers use the algorithm as a simple method of distinguishing valid numbers from mistyped or otherwise incorrect numbers.
Now, let's come to its weakness:
The verification algorithm does not allow the detection of certain permutations of digits. This is the case for pairs 09 and 90: any number containing a 0 replaced by a 9 and a 9 replaced by a 0 has an identical checksum.
Another weakness is the failure to detect a double error like 22 from/to 55 or 33 from/to 66 or even 44 from/to 77.
Also, The presence or absence of leading zeroes at the beginning of the number does not modify the checksum. It can be an advantage as well as a disadvantage.
Tell me in the comments about this magic trick!
(Also, the below image is of a dummy card ๐)
Take out your debit/credit card, and see the digits (For example ๐ฐ๐ฌ๐ฌ๐ฌ ๐ฌ๐ฌ๐ญ๐ฎ ๐ฏ๐ฐ๐ฑ๐ฒ ๐ณ๐ด๐ต๐ต)
Start from the first digit, multiply it by 2 and repeat this process for all digits which are at odd positions. So, after calculation, you would be seeing them like (๐ด-0-๐ฌ-0 ๐ฌ-0-๐ฎ-2 ๐ฒ-4-๐ญ๐ฌ-6 ๐ญ๐ฐ-8-๐ญ๐ด-9)
By this time, you might have noticed that some numbers after multiplication resulted in a 2-digit number. So, for such 2-digits numbers, add both of their digits to generate a single-digit number.
After this stage, your numbers would be like (8-0-0-0 0-0-2-2 6-4-๐ญ-6 ๐ฑ-8-๐ต-9)
Now, you have to just add all these digits together, the sum for my example would be: 8+0+0+0+0+0+2+2+6+4+1+6+5+8+9+9=60
This resultant sum would be always divisible by 10 if your debit/credit card number is valid.
This is not a magic trick, but Luhn's Algorithm/Checksum, which is used to validate your input number by card-issuing authorities.
Luhn Algorithm makes it possible to check numbers (Credit card, debit card, SIRET, etc.) thanks to its control key. If a character is misread or badly written, then Luhn's algorithm will detect this error.
Luhn Algorithm is known because MasterCard, American Express (AMEX), Visa, RuPay card and all other credit/debit cards use it.
The algorithm is in the public domain and is in wide use today. It is not intended to be a cryptographically secure hash function; it was designed to protect against accidental errors, not malicious attacks. Most credit cards and many government identification numbers use the algorithm as a simple method of distinguishing valid numbers from mistyped or otherwise incorrect numbers.
Now, let's come to its weakness:
The verification algorithm does not allow the detection of certain permutations of digits. This is the case for pairs 09 and 90: any number containing a 0 replaced by a 9 and a 9 replaced by a 0 has an identical checksum.
Another weakness is the failure to detect a double error like 22 from/to 55 or 33 from/to 66 or even 44 from/to 77.
Also, The presence or absence of leading zeroes at the beginning of the number does not modify the checksum. It can be an advantage as well as a disadvantage.
Tell me in the comments about this magic trick!
(Also, the below image is of a dummy card ๐)
