Skip to main content

Computing the Damm check digit

Project description

Damm algorithm decimal check digit

Note that check digits are NOT used for verification of data transfers between computers – use a CRC or a hash for that purpose! Check digits are used to check manual entry of a digit into a computer system.

A Damm check digit is a single check digit that can detect any single-digit error as well as any adjacent-digit transpositions. The digit computed in this module also detects some important phonetic errors (13<->30, 14<->40, … 19<–>90).

This makes the Damm check digit better than other, more well-known check digits like the Luhn code (used in credit cards) and the ISBN base-11 check digit. It is equal in detection strength to a Verhoeff check digit, but much simpler to compute.

Furthermore, a hexadecimal Damm check digit was added. This single hexadecimal check digit that detects every single-digit error as well as any adjacent-digit transpositions. The digit computed in this module also detects some important phonetic errors (13<->30, 14<->40, … 19<–>90). It also detects all jump-transposition errors (abc -> cba), 93.5 % of all twin digit errors (aa -> bb) and 93.5 % of all jump twin digit errors (aca -> bcb).

There are four functions in this module: encode, encode16, check and check16. The first two, encode and encode16 are used to calculate the check digit for a number that you have. Pass in a string with the number you want encoded and get a string with the check digit back. The other two, check and check16 are used to check that a number that was entered was entered correctly. Pass in a string with a number including check digit and get back True/False.

Damm algorithm

The Damm check digit is computed by starting with a check digit of zero and then continually multiplying this check digit with the digits of a given number, using the multiplication of a totally anti-symmetric quasigroup. The properties and the selection of the group ensure the qualities of the check digit stated above.

For further reference on how the algorithm works see http://en.wikipedia.org/wiki/Damm_algorithm

License information

Copyright (C) 2013 Johannes Spielmann

This module, damm, is licensed under the terms of the GNU General Public Licenses as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

For a full description of the license, please see the file

LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

damm-1.0.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file damm-1.0.tar.gz.

File metadata

  • Download URL: damm-1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for damm-1.0.tar.gz
Algorithm Hash digest
SHA256 cf6257b663c073d53f915fdcb439b718c202eeb15735a621d4f42b02db236208
MD5 d0fd2ecc884a54940819cc3fd55ffeb9
BLAKE2b-256 5a2ac66b8bf09ac9724f1935b16a2490050247c2b2b687b4fe312938a999c0df

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page