Key bank account number

key bank account number (bank account number = Bank account number) consists of 2 digits between 01 and 97 which supplements a number of bank account. It allows, by a algorithm, to check the validity of the account number.

Calculation algorithm of key bank account number

The number of bank account to format bank account number comprises 23 digits and can break up as follows:

\begin{matrix} R = & \ underbrace {r_ {1} \ ldots {} r_ {5}} & \ underbrace {r_ {6} \ ldots {} r_ {10}} & \ underbrace {r_ {11} \ ldots {} r_ {21}} & \ underbrace {r_ {22} r_ {23}} & = B.10^ {18} + G.10^ {13} + C.10^ {2} + K \ \ {} & B & G & C & K & \end{matrix}

where B is the Code banks, G the Code counter, C the Account number and K key bank account number.

Actually, the Account number can be made up at the same time of figures and letters. In order to apply the calculation algorithm, it is thus necessary, if necessary, to convert the letters into figures according to the table of correspondence below:

Then, the key K is calculated so that the remainder of the whole division of R by 97 is null and that K either ranging between 1 and 97, or:

R \ equiv 0 \ pmod {97} \ quad {\ rm with \,} 1 \ Leq K \ Leq 97

In particular, we have:

K \ equiv - (B.10^ {18} + G.10^ {13} + C.10^ {2}) \ pmod {97} \ equiv - (B.89 + G.15 + C.3) \ pmod {97}

A simple formula to calculate K is then:

K = 97 - \ Big ((89.B + 15.G + 3.C) \, \ bmod \, 97 \ Big)

Calculation algorithm which functions with entireties 32 bits

The number which poses problem is the account number, which, because of its eleven figures, does not place in an entirety 32 bits, even less when it is multiplied by three. The solution is to separate it in two numbers, the account number breaks up then as follows:

\begin{matrix} R = & \ underbrace {r_ {1} \ ldots {} r_ {5}} & \ underbrace {r_ {6} \ ldots {} r_ {10}} & \ underbrace {r_ {11} \ ldots {} r_ {16}} & \ underbrace {r_ {17} \ ldots {} r_ {21}} & \ underbrace {r_ {22} r_ {23}} & = B.10^ {18} + G.10^ {13} + D.10^ {7} + C.10^ {2} + K \ \ {} & B & G & D & C & K & \end{matrix}

Thus, the account number is broken up into C and D , having respectively five and six digits. The formula becomes then:

K \ equiv - (B.10^ {18} + G.10^ {13} + D.10^ {7} + C.10^ {2}) \ pmod {97} \ equiv - (B.89 + G.15 + D.76 + C.3) \ pmod {97}

The simple formula to calculate K becomes:

K = 97 - \ Big ((89.B + 15.G + 76.D + 3.C) \, \ bmod \, 97 \ Big)

It is calculable more using the whole type running in our current systems, i.e. the entirety 32 bits. An implementation out of C would be:

int cle_RIB (int B, int G, int D, int c)
{
    return 97 - ((89 * B + 15 * G + 76 * D + 3 * c) % 97);
}

External bonds

  • Calculation in line of key bank account number and implementation in PHP

Random links:Villenave-in Ornon | San Francisco de MacorĂ­s | La Poste Switzerland | Jeremy Manning | Gnaeus Cornelius Dolabella | d'Harleville_de_Collin