Sign in Join
Wiki copytemporary

ISO 7064: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: ISO 7064

OldNewLine
1+## Overview
2+
3+ISO 7064 specifies a set of check character systems capable of protecting strings against errors which occur when people copy or key data.
4+
5+The check character systems specified in ISO/IEC 7064:2002 can detect:
6+
7+- all single substitution errors (the substitution of a single character for another, for example 4234 for 1234);
8+- all or nearly all single (local) transposition errors (the transposition of two single characters, either adjacent or with * one character between them, for example 12354 or 12543 for 12345);
9+- all or nearly all shift errors (shifts of the whole string to the left or right);
10+- a high proportion of double substitution errors (two separate single substitution errors in the same string, for example 7234587 for 1234567);
11+- a high proportion of all other errors.
12+
13+## Function StrMOD97
14+
15+The function StrMOD97 can encode and verify a check character (an added character which may be used to verify the accuracy of the string by a mathematical relationship to that string) and a supplementary check character (a character which does not belong to the character set of the strings which are to be protected) in accordance with ISO 7064, MOD 97-10 for numeric strings with two check digits.
16+
17+``` pascal
18+function StrMOD97(s: String): integer;
19+// Pre-condition: s can only contain digits, otherwise this function will raise an exception.
20+// See https://wiki.freepascal.org/International_Bank_Account_Number for handling non digits
21+const
22+ modu = 97;
23+var
24+ sx: String;
25+ isx, ic, p: Integer;
26+begin
27+ p := Length( s );
28+ while ( p > 9 ) do
29+ begin
30+ sx := Copy( s, 1, 9 );
31+ Delete( s, 1, 9 );
32+ isx := StrToInt( sx );
33+ ic := isx mod modu;
34+ s := IntToStr( ic ) + s;
35+ p := Length( s );
36+ end;
37+ isx := StrToInt( s );
38+ if isx >= modu
39+ then ic := isx mod modu
40+ else ic := isx;
41+ result := ic;
42+end;
43+```
44+
45+## All ISO 7064 check character systems
46+
47+### Pure system algorithms
48+
49+Pure system algorithms use a single modulus for all stages of the computation.
50+
51+- ISO/IEC 7064, MOD 11-2 for numeric strings with one check digit or the supplementary check character **X**
52+- ISO/IEC 7064, MOD 37-2 for alphanumeric strings with one check digit or letter or the supplementary check character <font size =+1>*****</font> (asterisk)
53+- ISO/IEC 7064, MOD 97-10 for numeric strings with two check digits (implemented above)
54+- ISO/IEC 7064, MOD 661-26 for alphabetic strings with two check letters
55+- ISO/IEC 7064, MOD 1271-36 for alphanumeric strings with two check digits or letters
56+
57+### Hybrid system algorithms
58+
59+Hybrid system algorithms use two moduli in the computation. One modulus is equal to, and other other is greater than, the number of characters in the characters set of the string being protected. They always produce a single check character within the character set of the string to be protected.
60+
61+- ISO/IEC 7064, MOD 11,10 for numeric strings with one check digit
62+- ISO/IEC 7064, MOD 27,26 for alphabetic strings with one check letter
63+- ISO/IEC 7064, MOD 37,36 for alphanumeric strings with one check digit or letter
64+
65+## Usage
66+
67+The ISO/IEC 7064 standard has multiple applications including [[International Bank Account Number|International Bank Account Numbers]], International Standard Name Identifiers (ISNI), ORCID IDs and VAT identification numbers of several countries.
68+
69+## See also
70+
71+- [[International Bank Account Number]] an example of usage of the StrMOD97 function handling both digits and non-digits.
72+
73+---
74+*From the Free Pascal wiki, page "ISO 7064", as it stood on 2021-12-04 after a change by Jwdietrich, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history