Liking cljdoc? Tell your friends :D

stdnum.checkdigit

Standalone check-digit algorithms (Luhn, Verhoeff, ISO 7064), usable directly when you need the primitive rather than a typed identifier validator.

Each algorithm has a *-valid? predicate over a complete string (payload plus the trailing check character). Where it applies, an algorithm also has a *-check-digit or *-check calculator. The calculator 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 has a `*-valid?` predicate over a complete string (payload plus
the trailing check character). Where it applies, an algorithm also has a
`*-check-digit` or `*-check` calculator. The calculator returns the check
character for a bare payload.

    (luhn-valid? "79927398713")          ;=> true
    (luhn-check-digit "7992739871")       ;=> "3"
    (iso7064-mod11-2-check "000000021825009") ;=> "7"   (ORCID)
raw docstring

iso7064-mod11-2-checkclj

(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".
sourceraw docstring

iso7064-mod11-2-valid?clj

(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.
sourceraw docstring

iso7064-mod97-10-valid?clj

(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: its running remainder is 1. This is the LEI and IBAN style of 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: its running remainder is 1.
This is the LEI and IBAN style of checksum.
sourceraw docstring

luhn-check-digitclj

(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`.
sourceraw docstring

luhn-valid?clj

(luhn-valid? s)

True if the digit string s (payload plus its trailing check digit) satisfies the Luhn checksum. Non-digit input returns false and does not throw.

True if the digit string `s` (payload plus its trailing check digit) satisfies
the Luhn checksum. Non-digit input returns false and does not throw.
sourceraw docstring

verhoeff-check-digitclj

(verhoeff-check-digit payload)

The Verhoeff check digit (a one-character string) for payload.

The Verhoeff check digit (a one-character string) for `payload`.
sourceraw docstring

verhoeff-valid?clj

(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.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close