# 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\left\{matrix\right\} R = & \ underbrace \left\{r_ \left\{1\right\} \ ldots \left\{\right\} r_ \left\{5\right\}\right\} & \ underbrace \left\{r_ \left\{6\right\} \ ldots \left\{\right\} r_ \left\{10\right\}\right\} & \ underbrace \left\{r_ \left\{11\right\} \ ldots \left\{\right\} r_ \left\{21\right\}\right\} & \ underbrace \left\{r_ \left\{22\right\} r_ \left\{23\right\}\right\} & = B.10^ \left\{18\right\} + G.10^ \left\{13\right\} + C.10^ \left\{2\right\} + K \ \ \left\{\right\} & B & G & C & K & \end\left\{matrix\right\}$

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 \left\{97\right\} \ quad \left\{\ rm with \,\right\} 1 \ Leq K \ Leq 97$

In particular, we have:

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

A simple formula to calculate $K$ is then:

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

## 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\left\{matrix\right\} R = & \ underbrace \left\{r_ \left\{1\right\} \ ldots \left\{\right\} r_ \left\{5\right\}\right\} & \ underbrace \left\{r_ \left\{6\right\} \ ldots \left\{\right\} r_ \left\{10\right\}\right\} & \ underbrace \left\{r_ \left\{11\right\} \ ldots \left\{\right\} r_ \left\{16\right\}\right\} & \ underbrace \left\{r_ \left\{17\right\} \ ldots \left\{\right\} r_ \left\{21\right\}\right\} & \ underbrace \left\{r_ \left\{22\right\} r_ \left\{23\right\}\right\} & = B.10^ \left\{18\right\} + G.10^ \left\{13\right\} + D.10^ \left\{7\right\} + C.10^ \left\{2\right\} + K \ \ \left\{\right\} & B & G & D & C & K & \end\left\{matrix\right\}$

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

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

The simple formula to calculate $K$ becomes:

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

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