How does the internet company also e-commerce company verify that you have the credit card? It verifies using CVV2 Code and Luhn Algorithm. The Luhn Algorithm is used to validate all sorts of numbers, including credit cards numbers.
Who needs to validate Credit Card Number and Why?
When you buy a thing from a shop and pay by credit card then the shopkeeper sees that you own the card and he swipes it physically. When the card is swiped the data encoded in the chip in front or magnetic stripe on the back is read.
When one buys something on the internet using a credit card then the customer paying using a credit card has to enter the card number, expiration date, and an additional number printed on the card dubbed CVV2.
How does the internet company also e-commerce company verify that you have the card? It verifies using CVV2 Code and Luhn Algorithm. The different parts of the card or the Anatomy of the card is shown in the image below.
Card security codes are the three-digit numbers found in the signature panels on the back of Visa (Card Verification Value 2 — CVV2), MasterCard (Card Verification Code 2 — CVC 2) etc. These numbers are generated when the card is issued, by hashing the card number and expiration date under a key known only to the card issuer. These CVV codes helps merchants verify that their customers have their cards at the time of the transaction.
Have you thought that if the 3 digit number on back of credit card is called as CVV2 where is CVV1?
There are up to three tracks on magnetic cards known as track 1, 2, and 3. Track 3 is virtually unused by the major worldwide card networks. Point-of-sale card readers almost always read track 1, or track 2, and sometimes both, in case one track is unreadable. Track 1 has a higher bit density (210 bits per inch vs. 75), is the only track that may contain alphabetic text, and hence is the only track that contains the card holder’s name. One of the fields in this track layout is the Card Validation Code (CVC) or CVC1. which serves as a cryptographic integrity check on the track contents. Much like a message authentication code, the CVC simplifies the process of authenticating track data when it is received by the issuing bank.
The Luhn Algorithm or Luhn formula, also known as the modulus 10 or mod 10 algorithm, is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, National Provider Identifier numbers in the United States, Canadian Social Insurance Numbers, Israel ID Numbers and Greek Social Security Numbers (ΑΜΚΑ).
It was created by IBM scientist Hans Peter Luhn and described in U.S. Patent No. 2,950,048, filed on January 6, 1954, and granted on August 23, 1960.
Let’s see how to validate a credit card number. If you want to see the video on Luhn Algorithm you can click here.
- Take the credit card number and read the digits from the right. Double every other number and write them down
- Compute a weighted sum with the weight pattern 2,1,2,1,2,1 etc except that on multiplying a digit by 2 if you get a 2 digit number you add those digits together. For example 7 x 2=14 then it becomes 1+4=5
- Add up all of the results. If the sum ends in zero, then the credit card number is valid.
Let’s use Luhn algorithm to determine if the credit card number 3379 5135 6110 8795 is valid
Sum=70. These add up to 70 hence the credit card number is valid.
Use Luhn algorithm to determine check(last) digit of if the credit card number 2769 1483 0405 998?
These add up to 73 so check digit should be something that when added gives a multiple of 8. Nearest multiple of 10 is 80 so check digit is 80-73=7
YouTube video which explains the Luhn Algorithm is given below
You can try the website to https://binlist.net/ to find what information do the first 8 digits of your Master/Visa credit/debit card reveal.