Does the Luhn algorithm work for all mainstream credit cards? (Discover, Visa, Mastercard, Amex)

后端 未结 3 1083
生来不讨喜
生来不讨喜 2021-01-03 23:12

Reference: Luhn Algorithm

The Luhn Algorithm is a great way to quickly verify that the user typed their CC # in correctly.

However, I am concerned that there

3条回答
  •  借酒劲吻你
    2021-01-03 23:36

    The LUN check works on most credit cards. It is a modulus 10 check digit system to guarantee that the card number has been accurately read/recorded (mag stripe, virtual terminal or manual entry in the old days of the manual card imprinter).

    Back in the days of manual data entry, these check systems were used to make sure that keys like UPS's pickup book numbering system were accurately entered (modulus 7 check digit).

    It is even used in barcoding systems like code 128 which needs a modulus 103 digit added to the encoded data string to verify that the code was read right.

提交回复
热议问题