Verhoeff is a decimal checksum built on the dihedral group D5. It catches every single-digit substitution and, unlike Luhn (mod 10), every adjacent-digit transposition — the two most common human error classes. India's Aadhaar 12-digit ID uses it.
Enter a partial number and we'll compute the Verhoeff check digit to append (via inv[c] after running the accumulator with a placeholder 0).
Jacobus Verhoeff published this scheme in 1969 (Error Detecting Decimal Codes, Mathematical Centre Tracts). His empirical study of transcription errors ranked them by frequency: single-digit substitution (79 %), single adjacent transposition (10.2 %), twin errors (0.6 %), jump transpositions (0.8 %), phonetic errors (0.5 %) — and he set out to catch as many as possible with a pure mod-10 checksum. The dihedral group D5 is non-abelian, so d(a, b) ≠ d(b, a) in general — that non-commutativity is exactly what lets Verhoeff detect adjacent transpositions, which Luhn misses (Luhn accepts 09 ↔ 90 without complaint). Verhoeff catches 100 % of single-digit and adjacent-transposition errors, and ~95 % of twin and jump errors. India's Aadhaar 12-digit national ID and Deutsche Mark banknote serial numbers used it in production.