IBM-mod10-Check (Luhn Algorithm) for MasterCard, VISA

VISA
Example: 1234 6789 1234 6789

step 1: (1x2 + 3x2 + 6x2 + 8x2 + 1x2 + 3x2 + 6x2 + 8x2)

= 2 + 6 + 12 + 16 + 2 + 6 + 12 + 16

= 2 + 6 + 1+2 + 1+6 + 2 + 6 + 1+2 + 1+6

= 36

step 2: 2 + 4 + 7 + 9 + 2 + 4 + 7 + 9 = 44

step 3: 36 + 44 = 80

The card number is valid.

The sum is divisible by 10.


reference HKID+ISBN Master/Visa EAN°Ó«~±ø½X Code39±ø½X EAN-UCC