algorithmmathlinear-algebracheck-digit

Alternative base table for Damm algorithm


The Damm algorithm is awesome for handling check digits: https://en.wikipedia.org/wiki/Damm_algorithm

I would like to use it for two different entities of an application. However, they should not have the same check digit for the same number.

So I have to use different base tables for each entity. The base table is a totally anti-symmetric quasigroup with n=10.

The example from Wikipedia:

 |0 1 2 3 4 5 6 7 8 9
-+-------------------
0|0 3 1 7 5 9 8 6 4 2
1|7 0 9 2 1 5 4 8 6 3
2|4 2 0 6 8 7 1 3 5 9
3|1 7 5 0 9 8 3 4 2 6
4|6 1 2 3 0 4 5 9 7 8
5|3 6 7 4 2 0 9 5 8 1
6|5 8 6 9 7 2 0 1 3 4
7|8 9 4 5 3 6 2 0 1 7
8|9 4 3 8 6 1 7 2 0 5
9|2 5 8 1 4 3 6 7 9 0

How do I generate a second one, that is different but also of n=10?


Solution

  • A second table for n=10 is listed here:

    http://www.md-software.de/math/DAMM_Quasigruppen.txt

    Another approach would be to use the same table but start with another initial value for the interim digit, e.g. 1 instead of 0. Then the check digit is always different, but a disadvantage is that leading 1’s will not change the check digit, thus it might only be suitable for fixed length numbers.