Luhn Algorithm

calender iconUpdated on January 16, 2023
credit card
personal finance

Table of Contentstable of content icon

Luhn Algorithm

The Luhn algorithm is a checksum algorithm used to detect errors in identification numbers, such as credit card numbers and IMEI numbers. It is a modulo-10 algorithm, which means that the sum of the digits in the number is divided by 10, and the remainder is used to determine whether the number is valid.

Algorithm:

  1. Double every other digit: Starting from the rightmost digit, double every other digit in the number.
  2. Sum the digits: Add all the digits in the number, including the doubled digits.
  3. Modulo 10: Divide the sum by 10 and take the remainder.
  4. Check for equality: If the remainder is 0, the number is valid. Otherwise, it is not.

Example:

Given the credit card number 1234 5678 9012:

  1. Double every other digit: 1234 5678 9012 becomes 1234 1168 9012.
  2. Sum the digits: 1234 1168 9012 = 3644.
  3. Modulo 10: 3644 % 10 = 4.
  4. Check for equality: Since the remainder is not 0, the number is not valid.

Variations:

  • Luhn-2 algorithm: This algorithm doubles every other digit, but instead of adding the doubled digits, they are added as separate numbers.
  • Luhn-3 algorithm: This algorithm doubles every third digit, and the sum of the doubled digits is divided by 10.

Applications:

The Luhn algorithm is used in a variety of applications, including:

  • Credit card verification
  • IMEI number validation
  • Social Security number validation

Advantages:

  • Simple to implement
  • Effective at detecting errors
  • Relatively secure

Disadvantages:

  • Not foolproof: It is possible to create numbers that pass the Luhn algorithm but are not valid.
  • Can be cracked with enough effort: With enough time and resources, it is possible to crack the Luhn algorithm.

Categories

Pocketful Fintech Capital Private Limited (CIN U65999DL2021PTC390548):

The SEBI Registration No. allotted to us is INZ000313732.
NSE Member Code: 90326| BSE Member Code: 6808| MCX Member Code: 57120
DP CDSL: 12099800

Compliance Officer : Mr. Randhir Kumar Chaudhari
Tel no: 011- 49022222 / 011-49022277
Email: randhir@pocketful.in

Registered Address/Correspondence Address: C- 3, Ground Floor, Okhla Industrial Area, Phase - 1, New Delhi - 110020

For any complaints, drop us an email atlegal@pocketful.in

Procedure to file a complaint on SEBI SCORES: Register on SCORES portal. Mandatory details for filing complaints on SCORES: Name, PAN, Address, Mobile Number, E-mail ID.

Smart Online Dispute Resolution|Link To Circular|Procedures and Policies|Broker Investor Charter|DP Investor Charter

Benefits: Effective Communication, Speedy redressal of the grievances.

Benefits: Effective Communication, Speedy redressal of the grievances.

Please ensure you carefully read the Risk Disclosure Document as prescribed by SEBI and our Terms of Use and Privacy Policy.
The brand name Pocketful and logo is in process of trademarks registration. The cost-effective brokerage plans make Pocketful a trustworthy and reliable online stock broker. Available on both the web and mobile, it offers unmatched convenience to traders. If you are considering opening......

Read More