3

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?

chaotic3quilibrium
  • 5,661
  • 8
  • 53
  • 86
Alex Schneider
  • 335
  • 1
  • 6
  • 17

2 Answers2

0

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.

Michael
  • 46
  • 4
  • 1
    i marked this answer because it provides me with a second table for my use case. Thank you. However a general way to create further tables would be "more right". – Alex Schneider Apr 25 '16 at 13:01
  • Other tables can be found by a computer search, see Damm's dissertation page 103ff. – Michael Apr 26 '16 at 17:48
-1

Here's another table for n=10, origin unknown. Supposedly anti-symmetric. YMMV

0 9 8 7 6 5 4 3 2 1
1 0 5 8 7 6 9 4 3 2
2 1 0 9 8 7 6 5 4 3 
3 2 1 0 5 8 7 6 9 4 
4 3 2 1 0 9 8 7 6 5 
9 4 3 2 1 0 5 8 7 6 
6 5 4 3 2 1 0 9 8 7
7 6 9 4 3 2 1 0 5 8
8 7 6 5 4 3 2 1 0 9
5 8 7 6 9 4 3 2 1 0
bgroper
  • 11
  • 1
  • 1
    Welcome to StackOverflow! While this certainly provides useful information, it does not strictly respond to the request for generating this data. Could you provide any source for this data (even if that does not give details of derivation), or attempt to provide information in how it can be obtained? – ouflak Feb 05 '22 at 15:57
  • This table is not valid for n=10. It did not pass the validator located here: https://scastie.scala-lang.org/19ySJrbgRrCl5C0QDtn7QQ – chaotic3quilibrium May 23 '22 at 20:26