The credit card code

Credit cards have a hash digit that is used to validate whether a credit card number is valid or not. The algorithm for calculating this digit is known as the LUHN formula, based on ANSI X4.13. To calculate whether a credit card number is valid, follow these three steps:
Starting with the second digit on the right, multiply every other digit by two. If the result of any doubling is greater than 10 (e.g., 8 + 8 = 16), add the digits of this result. Add all of the doubled digits.

Add all other digits, with the exception of the last digit (the checksum), to this total.

The difference between the sum and the next multiple of 10 is the check digit.

For example, the correct hash digit for credit card number 5012 3456 7890 123X is 6.

Note: Until recently all credit card companies were using the same algorithm. Recent advances in credit card fraud have caused the credit card companies to pursue further measures of validating credit cards such as the 3-digit number found on the back of your credit card.” — From CISSP course

Liked this post? Follow this blog to get more. 

3 responses on “The credit card code”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Feel free to comment on this story directly above, but you can also go to copies posted to social media on the left, and reply to or comment on them there. Your responses via Twitter, Facebook, and Google+ will appear below.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Learn More)