It is a single digit computed from the other digits in the message. With a check digit, one can detect errors from the input of a series of digits.
Questions tagged [check-digit]
41 questions
17
votes
8 answers
Generating Luhn Checksums
There are lots of implementations for validating Luhn checksums but very few for generating them. I've come across this one however in my tests it has revealed to be buggy and I don't understand the logic behind the delta variable.
I've made this…

Alix Axel
- 151,645
- 95
- 393
- 500
16
votes
2 answers
Reverse engineering a check digit algorithm
I am trying to reverse engineer an algorithm used to generate a check digit.
Numbers are 8 digits long and the last digit is the check digit. I have thousands of valid numbers to test it on.
I have tried a standard Luhn, Verhoeff and modulo-10…

Neil
- 227
- 2
- 8
13
votes
2 answers
Single character signing scheme (minimal security)
Note: I originally posted this to Information Security, but I'm starting to think it might be more relevant here as it's really about determining what I should do with a request rather than securing information.
Situation
System A:
I have a system A…

3ocene
- 2,102
- 1
- 15
- 30
13
votes
3 answers
Extending the Damm algorithm to base-32
I'd like to use the Damm algorithm to generate check digits for codes with a 32-character alphabet. The algorithm itself is easily applied to any base (except 2 or 6). The difficulty is the necessary look-up table, which must be a totally…

cjm
- 61,471
- 9
- 126
- 175
9
votes
3 answers
How to generate a CUSIP check digit
CUSIPs are a 9-digit alphanumeric code for uniquely identifying a financial security.
https://en.wikipedia.org/wiki/CUSIP
They were invented in the 1964, and given the reliability of data transmission in the 60's, the 9th digit is actually a check…

friggle
- 3,362
- 3
- 35
- 47
6
votes
3 answers
API in Java or C++ to read MRZ Travel Document(passport) code
I am looking around for an API in java or c++ to read the MRZ and decode the MRZ code in travel documents(passports).
More information on MRZ is at http://www.highprogrammer.com/alan/numbers/mrp.html. Has any one done this before with an API?

Abhishek
- 6,862
- 22
- 62
- 79
5
votes
2 answers
Correct permutation cycle for Verhoeff algorithm
I'm implementing the Verhoeff algorithm for a check digit scheme, but there seems to be some disagreement in web sources as to which permutation cycle should form the basis of the permutation table.
Wikipedia uses: (36)(01589427)
while apparently,…

James
- 65,548
- 14
- 155
- 193
3
votes
3 answers
mod 11 check digit with regex
Is it possible to create a mod 11 check digit routine with a regex statement?
THe nubmer is a 10 digit number,
Step 1:
A = (2nd number * 2) + (3rd number * 4) + (4th number * 8) + (5th number * 5) + (6th number * 10) + (7th number * 9) + (8th number…

Jeremy
- 44,950
- 68
- 206
- 332
3
votes
1 answer
Can't find the digit check algorithm
I can´t find which algorithm is being used to to calculate the 2 digits check digit of my bank references.
Some examples
0404 3295 60983
0707 3328 25810
0900 9907 32991
0900 8912 91695
0707 2268 89938
0808 1153 45010
0808 0964 91963
0900 6632…

Fraga
- 1,361
- 2
- 15
- 47
3
votes
2 answers
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…

Alex Schneider
- 335
- 1
- 6
- 17
3
votes
2 answers
How can I calculate an IBAN national check digit?
Following Wikipedia, I’m developing a Java application that calculates and verifies IBANs from various countries. Some BBAN have a national check digit, but I can't find any documentation about how to calculate it. Where I can find the algorithm for…

Tostis
- 386
- 2
- 5
- 13
2
votes
2 answers
How to calculate the check digit according to ISO 6346
How to implement the check digit algorithm specified in ISO 6346:2022 Freight containers — Coding, identification and marking?
See how is the check digit of a container calculated?
This is a self-answered question.

Damien
- 1,140
- 15
- 22
2
votes
1 answer
Checkdigit algorithm Luhn mod N vs simple sum
Do you know why the Luhn mod N algoritm in order to create the check digit performs a sum by doubling the value of each even placed char instead of perfoming a simple sum of all chars?
In pseudo-code words:
given:
var s = "some string i want to…

Marco Demaio
- 33,578
- 33
- 128
- 159
2
votes
1 answer
Error correction based on Damm check digit
If you use the Damm algorithm to generate check digits, is there a method to try correcting the error if the code doesn't validate?

Remko
- 823
- 6
- 16
2
votes
3 answers
Optimizing the Verhoeff Algorithm in R
I have written the following function to calculate a check digit in R.
verhoeffCheck <- function(x)
{
## calculates check digit based on Verhoeff algorithm
## note that due to the way strsplit works, to call for vector x, use…

James
- 65,548
- 14
- 155
- 193