Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Check digit
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Design == Check digit [[algorithm]]s are generally designed to capture ''human'' [[transcription error]]s. In order of complexity, these include the following:<ref name=Kirtland2001_p4-6>{{cite book|last=Kirtland|author-link=Joseph Kirtland|year=2001|first=Joseph|title=Identification Numbers and Check Digit Schemes|publisher=Mathematical Association of America|series=Classroom Resource Materials|pages=4β6|url=https://books.google.com/books?id=npTxORxmLosC&pg=PA4|isbn=978-0-88385-720-5}}</ref> * letter/digit errors, such as l β 1 or O β 0 * single-digit errors, such as 1 β 2 * transposition errors, such as 12 β 21 * twin errors, such as 11 β 22 * jump transpositions errors, such as 132 β 231 * jump twin errors, such as 131 β 232 * phonetic errors, such as 60 β 16 ("sixty" to "sixteen") In choosing a system, a high probability of catching errors is traded off against implementation difficulty; simple check digit systems are easily understood and implemented by humans but do not catch as many errors as complex ones, which require sophisticated programs to implement. A desirable feature is that left-padding with zeros should not change the check digit. This allows variable length numbers to be used and the length to be changed. If there is a single check digit added to the original number, the system will not always capture ''multiple'' errors, such as two replacement errors (12 β 34) though, typically, double errors will be caught 90% of the time (both changes would need to change the output by offsetting amounts). A very simple check digit method would be to take the sum of all digits ([[digital root|digital sum]]) [[modulo operation|modulo]] 10. This would catch any single-digit error, as such an error would always change the sum, but does not catch any transposition errors (switching two digits) as re-ordering does not change the sum. A slightly more complex method is to take the [[weighted sum]] of the digits, modulo 10, with different weights for each number position. To illustrate this, for example if the weights for a four digit number were 5, 3, 2, 7 and the number to be coded was 4871, then one would take 5Γ4 + 3Γ8 + 2Γ7 + 7Γ1 = 65, i.e. 65 modulo 10, and the check digit would be 5, giving 48715. Systems with weights of 1, 3, 7, or 9, with the weights on neighboring numbers being different, are widely used: for example, 31 31 weights in [[Universal Product Code|UPC]] codes, 13 13 weights in [[European Article Number|EAN]] numbers (GS1 algorithm), and the 371 371 371 weights used in United States bank [[ABA routing transit number|routing transit numbers]]. This system detects all single-digit errors and around 90%{{Citation needed|date=August 2023}} of transposition errors. 1, 3, 7, and 9 are used because they are [[Coprime integers|coprime]] with 10, so changing any digit changes the check digit; using a coefficient that is divisible by 2 or 5 would lose information (because 5Γ0 = 5Γ2 = 5Γ4 = 5Γ6 = 5Γ8 = 0 modulo 10) and thus not catch some single-digit errors. Using different weights on neighboring numbers means that most transpositions change the check digit; however, because all weights differ by an even number, this does not catch transpositions of two digits that differ by 5 (0 and 5, 1 and 6, 2 and 7, 3 and 8, 4 and 9), since the 2 and 5 multiply to yield 10. The {{sic|hide=y|ISB|N-10}} code instead uses modulo 11, which is prime, and all the number positions have different weights 1, 2, ... 10. This system thus detects all single-digit substitution and transposition errors (including jump transpositions), but at the cost of the check digit possibly being 10, represented by "X". (An alternative is simply to avoid using the serial numbers which result in an "X" check digit.) {{sic|hide=y|ISB|N-13}} instead uses the GS1 algorithm used in EAN numbers. More complicated algorithms include the [[Luhn algorithm]] (1954), which captures 98% of single-digit transposition errors (it does not detect 90 β 09) and the still more sophisticated [[Verhoeff algorithm]] (1969), which catches all single-digit substitution and transposition errors, and many (but not all) more complex errors. Similar is another [[abstract algebra]]-based method, the [[Damm algorithm]] (2004), that too detects all single-digit errors and all adjacent transposition errors. These three methods use a single check digit and will therefore fail to capture around 10%{{Citation needed|date=August 2023}} of more complex errors. To reduce this failure rate, it is necessary to use more than one check digit (for example, the modulo 97 check referred to below, which uses two check digitsβfor the algorithm, see [[International Bank Account Number]]) and/or to use a wider range of characters in the check digit, for example letters plus numbers.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)