Search code examples
algorithmchecksumcrccrc32luhn

Algorithm for one sign checksum


I am desperate in the search for an algorithm to create a checksum that is a maximum of two characters long and can recognize the confusion of characters in the input sequence. When testing different algorithms, such as Luhn, CRC24 or CRC32, the checksums were always longer than two characters. If I reduce the checksum to two or even one character, then no longer all commutations are recognized.

Does any of you know an algorithm that meets my needs? I already have a name with which I can continue my search. I would be very grateful for your help.


Solution

  • Taking that your data is alphanumeric, you want to detect all the permutations (in the perfect case), and you can afford to use the binary checksum (i.e. full 16 bits), my guess is that you should probably go with CRC-16 (as already suggested by @Paul Hankin in the comments), as it is more information-dense compared to check-digit algorithms like Luhn or Damm, and is more "generic" when it comes to possible types of errors.

    Maybe something like CRC-CCITT (CRC-16-CCITT), you can give it a try here, to see how it works for you.