Enum codes_check_digits::iso_7064::IsoVariant
source · pub enum IsoVariant {
Mod_11_2,
Mod_11_10,
Mod_27_26,
Mod_37_2,
Mod_37_36,
Mod_97_10,
Mod_661_26,
Mod_1271_36,
}Variants§
Mod_11_2
The data digits must be ‘0’ - ‘9’ but the check digit may also be ‘X’ (representing the value 10). Usage: unknown. This is not the ISBN check.
Mod_11_10
The ISO 7064 standard defines a family of check digits in the form of “Mod N+1,N”.
It catches all single digit errors but does not catch transposition errors “01” → “10” (but not vice-versa) and “34” → “43” (but not vice-versa).
Mod_27_26
ISO 7064 Mod_27_26 – same as Mod_37_36 but restricted to ‘A’-‘Z’
Mod_37_2
Mod_37_36
This scheme works similar to Mod_11_10, but is defined to use alphanumeric characters ‘0’ -‘9’, ‘A’ - ‘Z’ for the data and check digit
Mod_97_10
While this scheme is described in the standard as taking only a numeric alphabet it is used in a number of other standards with alpha-numeric input.
- IF alpha-numeric:
- replace any alphabetic character with it’s numeric equivalent where ‘A’ is 10, ‘B’ is 11, etc. The input string ‘9A8C’ therefore becomes ‘910812’.
- Convert this string into an integer value. An arbitrary precision integer is likely needed for longer input strings.
- The check value is calculated as
98 - (n % 97). - If the value is less than 10 add a ‘0’ pad character to the left to produce the two character value.
Mod_661_26
ISO 7064 Mod_661_26 – restricted to ‘A’-‘Z’ and produces 2 check digits
Mod_1271_36
ISO 7064 Mod_1271_36 – alphanumeric and produces 2 check digits