Sign in Join
Wiki copytemporary

ISO 7064: what changed

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

OldNewLine
11## Overview
22
33ISO 7064 specifies a set of check character systems capable of protecting strings against errors which occur when people copy or key data.
44
55The check character systems specified in ISO/IEC 7064:2002 can detect:
66
77- all single substitution errors (the substitution of a single character for another, for example 4234 for 1234);
88- 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);
99- all or nearly all shift errors (shifts of the whole string to the left or right);
1010- a high proportion of double substitution errors (two separate single substitution errors in the same string, for example 7234587 for 1234567);
1111- a high proportion of all other errors.
1212
1313## Function StrMOD97
1414
1515The 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.
1616
1717``` pascal
1818function StrMOD97(s: String): integer;
1919// Pre-condition: s can only contain digits, otherwise this function will raise an exception.
2020// See https://wiki.freepascal.org/International_Bank_Account_Number for handling non digits
2121const
2222 modu = 97;
2323var
2424 sx: String;
2525 isx, ic, p: Integer;
2626begin
2727 p := Length( s );
2828 while ( p > 9 ) do
2929 begin
3030 sx := Copy( s, 1, 9 );
3131 Delete( s, 1, 9 );
3232 isx := StrToInt( sx );
3333 ic := isx mod modu;
3434 s := IntToStr( ic ) + s;
3535 p := Length( s );
3636 end;
3737 isx := StrToInt( s );
3838 if isx >= modu
3939 then ic := isx mod modu
4040 else ic := isx;
4141 result := ic;
4242end;
4343```
4444
4545## All ISO 7064 check character systems
4646
4747### Pure system algorithms
4848
4949Pure system algorithms use a single modulus for all stages of the computation.
5050
5151- 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)
52+- ISO/IEC 7064, MOD 37-2 for alphanumeric strings with one check digit or letter or the supplementary check character ***** (asterisk)
5353- ISO/IEC 7064, MOD 97-10 for numeric strings with two check digits (implemented above)
5454- ISO/IEC 7064, MOD 661-26 for alphabetic strings with two check letters
5555- ISO/IEC 7064, MOD 1271-36 for alphanumeric strings with two check digits or letters
5656
5757### Hybrid system algorithms
5858
5959Hybrid 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.
6060
6161- ISO/IEC 7064, MOD 11,10 for numeric strings with one check digit
6262- ISO/IEC 7064, MOD 27,26 for alphabetic strings with one check letter
6363- ISO/IEC 7064, MOD 37,36 for alphanumeric strings with one check digit or letter
6464
6565## Usage
6666
6767The 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.
6868
6969## See also
7070
7171- [[International Bank Account Number]] an example of usage of the StrMOD97 function handling both digits and non-digits.
7272
7373---
7474*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