Damm algorithm: Difference between revisions

Content deleted Content added
Ref. corrected
m Do general fixes and cleanup using AWB (8843)
Line 6:
 
== Algorithm ==
The validity of a digit sequence containing a check digit is defined over a quasigroup. A quasigroup table ready for use can be taken from Damm's dissertation (pages 98, 106, 111).<ref name=dhmd />. It is useful to rearrange the rows and to change the entries correspondingly so that each diagonal entry is 0, because it simplifies the check digit calculation.
 
=== Validating a number against the included check digit ===
Line 20:
 
== Example ==
The TA-quasigroup is taken from Damm's doctoral dissertation page 111.<ref name=dhmd />. It is modified by rearranging the columns and changing the entries correspondingly as described above.
{| class="wikitable" style="text-align:center;background:none;color:#E000E0"
|- style="color:#00A000"
Line 111:
 
== Graphical illustration ==
[[File:Check digit TA quasigroup dhmd111rr illustration eg5724.svg]]
[[File:Check_digit_TA_quasigroup_dhmd111rr_illustration_eg5724.svg]]
 
== Source code ==
 
=== [[C (programming language)|C]] ===
<source lang="c">
char Taq(char* number)
Line 145:
 
== Strengths and weaknesses ==
The Damm algorithm is similar to the [[Verhoeff algorithm]]. It too will detect ''all'' occurrences of altering one single digit and ''all'' occurrences of transposing two adjacent digits. (These are the two most frequently appearing types of [[transcription error]]s.<ref name=dhmd />). But the Damm algorithm has the benefit that it makes do without the dedicatedly constructed [[permutation]]s and its position specific [[Exponentiation#In_abstract_algebra|powers]] being inherent in the [[Verhoeff algorithm|Verhoeff scheme]]. Furthermore, a table of [[Inverse_elementInverse element|inverses]] can be dispensed with provided all diagonal entries of the operation table are zero.
 
The Damm algorithm does not suffer from exceeding the number of 10 possible values, resulting in the need for using a non-digit character (as the [[X]] in the [[ISBN#ISBN-10_check_digit_calculation|ISBN-10]] [[Check_digit#ISBN_10|check digit]] scheme).