Working notes start here

Note - text that has been struck out is legacy text that needs to be updated to reflect the new algorithm.

Working notes end here

Algorithms edit

Validating the IBAN edit

  • No change

Generating IBAN check digits edit

  • No change

Modulo operation on IBAN edit

Any computer programming language or software package that is used to compute D mod 97 directly must have the ability to handle integers of more than 30 digits. In practice, this can only be done by software that either supports arbitrary-precision arithmetic or that can handle 128 bit integers,[Note 1] features that are often not standard. If the application software in use does not provide the ability to handle integers of this size, the modulo operation can be performed in a piece-wise manner (as is the case with the UN CEFACT TBG5 Javascript program).

Piece-wise calculation D mod 97 can be done in many ways. One such way is as follows:[1]

Note
  • In this algorithm, text strings are represented using upper case letters and integers by lower case letters. Thus D is a character string representation of d.
  • The conversion between integers to text and back again can be streamlined. It is done in the example to simplify the explanation.
If we wish to find d mod 97, proceed as follows:
1. Break the string D into p pieces I1, I2, ..., Ip. The size of each piece is arbitrary, subject only to the constraint that the computer must be able to evaluate
  • I1 mod 97
  • (100 x Ik) mod 97 where k > 1.
2. Define m0 as 0.
3. For each segment starting with k = 1, perform the following:
  • Form the string Mk by concatenating Jk-1 and Ik
  • Set mk equal to jk mod 97
4. The value mp is equal to d mod 97.

Example of IBAN check digit test edit

In this example, the above algorithm for evaluating d mod 97 will be applied to 3214282912345698765432161182 mod 97. (For clarification, the digits in green are also shown in green in the table below.) If the result is one, the IBAN corresponding to d passes the check digit test. The choice of breaking the string D into substrings each of six characters is entrely arbitrary.

In the table below:

  • Column i are numbers corresponding to the digit positions, counting from right to left.
  • Column di are the values of the digits.
  • Column ai are the progressive values calculated as ai = (ai -1 x 10) mod 97 with the initial item a1 = 1 due to the definition ai = 10(i -1) mod 97 .

The values ai are independent of the IBAN being checked, i.e., they form a constant array for all check digit tests on IBANs with a certain length. The value 6 is highlighted to show the propagation of the values of mk from one row to the next.

k digit
positions
Ik Jk = Mk-1 && Ik m = jk mod 97
0 n/a 0
1 1-6 321428 00321428 67
2 7-12 291234 67291234 6
3 13-18 569876 06569876 66
4 19-24 543216 66543216 52
5 25-28 1182 521182 1

The value in the bottom right-hand cell is the remainer when dividing 3214282912345432161182 by 97. Since it has the value 1, the IBAN passes the sanity test.

Notes edit

  1. ^ 2127 is equal 1.7 × 1038

Refernces edit

  1. ^ "Standard 48 - Format of the IBAN issued in the UK (International Bank Account Number)" (PDF). London: UK Payments Administration. June 2007. Retrieved 20 August 2012.