HOME

TheInfoList



OR:

In
error detection In information theory and coding theory with applications in computer science and telecommunication, error detection and correction (EDAC) or error control are techniques that enable reliable delivery of digital data over unreliable communi ...
, the Damm algorithm is a
check digit A check digit is a form of redundancy check used for error detection on identification numbers, such as bank account numbers, which are used in an application where they will at least sometimes be input manually. It is analogous to a binary parity ...
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
that detects all single-digit errors and all adjacent transposition errors. It was presented by H. Michael Damm in 2004.


Strengths and weaknesses


Strengths

The Damm algorithm is similar to the
Verhoeff algorithm The Verhoeff algorithm is a checksum formula for error detection developed by the Dutch mathematician Jacobus Verhoeff and was first published in 1969. It was the first decimal check digit algorithm which detects all single-digit errors, and all ...
. It too will detect ''all'' occurrences of the two most frequently appearing types of transcription errors, namely altering one single digit, and transposing two adjacent digits (including the transposition of the trailing check digit and the preceding digit). But the Damm algorithm has the benefit that it makes do without the dedicatedly constructed permutations and its position specific powers being inherent in the Verhoeff scheme. Furthermore, a table of inverses can be dispensed with provided all main 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 10-digit ISBN
check digit A check digit is a form of redundancy check used for error detection on identification numbers, such as bank account numbers, which are used in an application where they will at least sometimes be input manually. It is analogous to a binary parity ...
scheme). Prepending leading zeros does not affect the check digit (a weakness for variable-length codes). There are totally anti-symmetric quasigroups that detect all phonetic errors associated with the English language (13 ↔ 30, 14 ↔ 40, ..., 19 ↔ 90). The table used in the illustrating example is based on an instance of such kind.


Weaknesses

For all checksum algorithms including the Damm algorithm, prepending leading zeroes does not affect the check digit, so 1, 01, 001, etc. produce the same check digit. Consequently variable-length codes should not be verified together.


Design

Its essential part is a
quasigroup In mathematics, especially in abstract algebra, a quasigroup is an algebraic structure resembling a group in the sense that " division" is always possible. Quasigroups differ from groups mainly in that they need not be associative and need not have ...
of order 10 (i.e. having a
Latin square In combinatorics and in experimental design, a Latin square is an ''n'' × ''n'' array filled with ''n'' different symbols, each occurring exactly once in each row and exactly once in each column. An example of a 3×3 Latin sq ...
as the body of its operation table) with the special feature of being weakly totally anti-symmetric. Damm revealed several methods to create totally anti-symmetric quasigroups of order 10 and gave some examples in his doctoral dissertation. With this, Damm also disproved an old conjecture that totally anti-symmetric quasigroups of order 10 do not exist. A quasigroup is called totally anti-symmetric if for all , the following implications hold: # # , and it is called weak totally anti-symmetric if only the first implication holds. Damm proved that the existence of a totally anti-symmetric quasigroup of order is equivalent to the existence of a weak totally anti-symmetric quasigroup of order . For the Damm algorithm with the check equation a weak totally anti-symmetric quasigroup with the property is needed. Such a quasigroup can be constructed from any totally anti-symmetric quasigroup by rearranging the columns in such a way that all zeros lay on the diagonal. And, on the other hand, from any weak totally anti-symmetric quasigroup a totally anti-symmetric quasigroup can be constructed by rearranging the columns in such a way that the first row is in natural order.


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). It is useful if each main diagonal entry is 0, because it simplifies the check digit calculation.


Validating a number against the included check digit

#Set up an interim digit and initialize it to 0. #Process the number digit by digit: Use the number's digit as column index and the interim digit as row index, take the table entry and replace the interim digit with it. #The number is valid if and only if the resulting interim digit has the value of 0.


Calculating the check digit

Prerequisite: The main diagonal entries of the table are 0. #Set up an interim digit and initialize it to 0. #Process the number digit by digit: Use the number's digit as column index and the interim digit as row index, take the table entry and replace the interim digit with it. #The resulting interim digit gives the check digit and will be appended as trailing digit to the number.


Example

The following operation table will be used. It may be obtained from the totally anti-symmetric quasigroup in Damm's doctoral dissertation page 111 by rearranging the rows and changing the entries with the permutation and defining . Suppose we choose the number (digit sequence) 572.


Calculating the check digit

The resulting interim digit is 4. This is the calculated check digit. We append it to the number and obtain 5724.


Validating a number against the included check digit

The resulting interim digit is 0, hence the number is valid.


Graphical illustration

This is the above example showing the detail of the algorithm generating the check digit (dashed blue arrow) and verifying the number 572 with the check digit.


References


External links

* Damm validation & generation code in several programming languages
Practical application in SingaporeQuasigroups for the Damm algorithm up to order 64At RosettaCode.org, Implementations of the Damm algorithm in many programming languages
{{DEFAULTSORT:Damm Algorithm Checksum algorithms Algebraic structures Latin squares Group theory 2004 introductions