Standalone check-digit algorithms (Luhn, Verhoeff, ISO 7064), usable directly when you need the primitive rather than a typed identifier validator.
Each algorithm offers a *-valid? predicate over a complete string (payload +
trailing check character) and, where meaningful, a *-check-digit /
*-check calculator that returns the check character for a bare payload.
(luhn-valid? "79927398713") ;=> true
(luhn-check-digit "7992739871") ;=> "3"
(iso7064-mod11-2-check "000000021825009") ;=> "7" (ORCID)
Standalone check-digit algorithms (Luhn, Verhoeff, ISO 7064), usable directly
when you need the primitive rather than a typed identifier validator.
Each algorithm offers a `*-valid?` predicate over a complete string (payload +
trailing check character) and, where meaningful, a `*-check-digit` /
`*-check` calculator that returns the check character for a bare payload.
(luhn-valid? "79927398713") ;=> true
(luhn-check-digit "7992739871") ;=> "3"
(iso7064-mod11-2-check "000000021825009") ;=> "7" (ORCID)(iso7064-mod11-2-check payload)The ISO 7064 Mod 11-2 check character for the digit string payload, as
"0"-"9" or "X".
The ISO 7064 Mod 11-2 check character for the digit string `payload`, as "0"-"9" or "X".
(iso7064-mod11-2-valid? s)True if s (digits plus a final "0"-"9"/"X" check character) is valid
under ISO 7064 Mod 11-2.
True if `s` (digits plus a final "0"-"9"/"X" check character) is valid under ISO 7064 Mod 11-2.
(iso7064-mod97-10-valid? s)True if the alphanumeric string s (letters A-Z taken as 10-35, check digits
included) is valid under ISO 7064 Mod 97-10 - i.e. its running remainder is 1.
This is the LEI / IBAN-style checksum.
True if the alphanumeric string `s` (letters A-Z taken as 10-35, check digits included) is valid under ISO 7064 Mod 97-10 - i.e. its running remainder is 1. This is the LEI / IBAN-style checksum.
(luhn-check-digit payload)The Luhn check digit (a one-character string) for the bare payload digit
string payload.
The Luhn check digit (a one-character string) for the bare payload digit string `payload`.
(luhn-valid? s)True if the digit string s (payload plus its trailing check digit) satisfies
the Luhn checksum. Non-digit input returns false rather than throwing.
True if the digit string `s` (payload plus its trailing check digit) satisfies the Luhn checksum. Non-digit input returns false rather than throwing.
(verhoeff-check-digit payload)The Verhoeff check digit (a one-character string) for payload.
The Verhoeff check digit (a one-character string) for `payload`.
(verhoeff-valid? s)True if the digit string s (payload plus check digit) satisfies the Verhoeff
checksum. Non-digit input returns false.
True if the digit string `s` (payload plus check digit) satisfies the Verhoeff checksum. Non-digit input returns false.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |