Credit card verification

Source: Internet
Author: User
Credit card verificationAlgorithmLuhn

In fact, credit card numbers have algorithms to Ensure Right and Wrong. First

Card category prefix length check algorithm
MC 51-55 16 luhn
Visa 4 13, 16 luhn
AmEx 34, 37 15 luhn
Diners 300-305, 36, 38 14 luhn
Novus 6011 16 luhn
Enroute 2014, 2149 16 none
JCB 3 16 luhn
JCB 2131, 1800 15 luhn

In addition, the luhn algorithm is used to verify all data. In fact, the luhn algorithm is very simple, that is Starting from a single digit (first digit), the number of the second digit (next digit is a hundred digits) is added, starting from the tenth digit (second digit), and the number of the second digit (next digit is a thousand digits) the number multiplied by 2. If the number is greater than 9, then the number 9 is subtracted and the two and the result are added. If it is a multiple of 10, the card number is correct. .

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.