Luhn algorithm: Difference between revisions

Content deleted Content added
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1:
{{Short description|Simple checksum formula}}
{{redirects|Luhn|people named Luhn|Luhn (surname)}}
 
The '''Luhn algorithm''' or '''Luhn formula''' (creator: [[IBM]] scientist [[Hans Peter Luhn]]), also known as the "[[modular arithmetic|modulus]] 10" or "mod 10" [[algorithm]], is a simple [[check digit]] formula used to validate a variety of identification numbers. {{efn|It is described in [[United States|US]] patent 2950048A, granted on {{date|1960-08-23|DMY}}.<ref name="US2950048A">{{cite patent|title=Computer for Verifying Numbers|country=US|number=2950048A|status=patent|pubdate={{date|1960-08-23|DMY}}|gdate={{date|1960-08-23|DMY}}|invent1=Luhn|inventor1-first=Hans Peter|fdate=1954-01-06|inventorlink=Hans Peter Luhn}}</ref>}}
 
Line 107:
parity := length mod 2
'''for''' i from 1 to (length - 1) '''do'''
'''if''' i mod 2 !== parity '''then'''
sum := sum + cardNumber[i]
'''elseif''' cardNumber[i] > 4 '''then'''
Line 128:
* [[South Africa|South African]] ID numbers
* [[South Africa|South African]] Tax reference numbers
* [[Personal identity number (Sweden)| Swedish]] [[nationalPersonal identificationidentity numbers number]]s
* [[Sweden|Swedish]] Corporate Identity Numbers (OrgNr)
* [[Greece|Greek]] Social Security Numbers (ΑΜΚΑ)