The above are numbers which the ending number is a check digit for the entire number (apart from the last digit obviously)

I want to know which check digit algorithm is used to calculate this checksum I used Luhn algorithm (1954), Verhoeff algorithm (1969) and the Damm algorithm (2004) with no luck, they create check digits but not the one already shown here

I am confident that these are valid number for the check digit, it's just that I don't know what the algorithm, can anyone help or give some pointers

  • 1
    $\begingroup$ Are they from barcodes ? If yes, can you show one ? $\endgroup$ – Yves Daoust Apr 29 at 9:12
  • $\begingroup$ they are not from bar codes, they are from the national identity card of Sri Lanka, which has not published how they generate the check digit $\endgroup$ – Miyuru Dharmage May 5 at 6:23
  • $\begingroup$ At least try one of these, or variations: en.wikipedia.org/wiki/International_Standard_Book_Number. Sri Lanka might have taken inspiration there. $\endgroup$ – Yves Daoust May 5 at 7:10
  • $\begingroup$ I posted the question after these test algo including the ISBN, IBAN among others including the raw modulo 10 and other variation, my question is there a way to reverse the formula or are there any good pattern identification formulas $\endgroup$ – Miyuru Dharmage May 5 at 8:57
  • $\begingroup$ Sorry. Reversing the formula doesn't seem possible, as the checksum function performs a strong compression, from eleven digits to a single. A pattern could be easier to spot if you could change a single digit at a time. $\endgroup$ – Yves Daoust May 5 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.