serhii.net LINKS BLOG!

In the middle of the desert you can say anything you want

09 Jan 2017

Luhn algorithm (checking validity of CCs, SSNs etc) - Wikipedia

Categories:
  • IT/CS/Algorithms
  • (show all) All categories:
  • IT
  • IT/CS
  • IT/CS/Algorithms

  • Tags:
  • Algorithms
  • Credit-cards
  • Ssn
  • Cc
  • Error-checking
  • Safeguard
  • Wikipedia

  • Rating: 6; Complexity: 5
    Title: Luhn algorithm (checking validity of CCs, SSNs etc) - Wikipedia
    Link: https://en.wikipedia.org/wiki/Luhn_algorithm

    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 etc The Luhn algorithm will detect any single-digit error, as well as almost all transpositions of adjacent digits. It will not, however, detect transposition of the two-digit sequence 09 to 90 (or vice versa). It will detect 7 of the 10 possible twin errors (it will not detect 22 ↔ 55, 33 ↔ 66 or 44 ↔ 77). It is not intended to be a cryptographically secure hash function; it was designed to protect against accidental errors, not malicious attacks. Most credit cards and many government identification numbers use the algorithm as a simple method of distinguishing valid numbers from mistyped or otherwise incorrect numbers.