# Mayelana nokuqina kwe-IBAN0422

Njengoba kwaziwa, i-IBAN yaseJalimane iqukethe ikhodi yezwe (DE), idijithi yesheke enezinombolo ezimbili (ngokwe- ISO 7064 ), ikhodi yasebhange (amadijithi angu-8) kanye nenombolo ye-akhawunti (kuhlanganise nenombolo ye-akhawunti encane, 10). -idijithi, amadijithi alahlekile agcwaliswa ngoziro abaholayo) ngakho-ke inamadijithi angama-22. Ukuze ubale idijithi yesheke, lokho okubizwa nge-BBAN (ikhodi yasebhange nenombolo ye-akhawunti) kanye nekhodi yezwe yezinombolo $$1314$$ yaseJalimane kanye nedijithi yesheke $$00$$ ) kwakhiwa.

Isibonelo, ikhodi yasebhange engu-21050170 kanye nenombolo ye-akhawunti ethi 12345678 ibuyisela i-BBAN 210501700012345678, inwetshwe ngekhodi yezwe kanye nedijithi yesheke engu-00 bese $$x = 210501700012345678131400$$ idijithi ethi 9 $$98 - (x \mod 97)$$ inombolo engu-9) manje: 8 ikuphi: $$98 - (x \mod 97)$$ . Akuqondakali ukuthi lokhu kuhlukaniswe ngokuthi $$97$$ . Njengenombolo enkulu yamadijithi amabili eyinhloko, ibona okufakiwe okungalungile njengamadijithi aguquliwe okungenzeka kakhulu. Manje sibonisa izitatimende ezilandelayo:

1. Ukushintsha idijithi eyodwa ye-IBAN evumelekile kuzoholela ku-IBAN engavumelekile.
2. Ukushintsha amadijithi amabili ahlukene e-IBAN evumelekile kungaholela ku-IBAN evumelekile.
3. Uma izikhundla ezimbili ezihlukene ze-IBAN evumelekile zishintshwa, kwakhiwa i-IBAN engavumelekile.
4. Uma ushintshanisa kabili izikhundla ezimbili ezihlukene ze-IBAN evumelekile, kungaba ne-IBAN evumelekile.

Vumela $$A = DE P_1 P_2 N_1 N_2 N_3 N_4 N_5 N_6 N_7 N_8 N_9 N_{10} N_{11} N_{12} N_{13} N_{14} N_{15} N_{16} N_{17} N_{18}$$ i-IBAN evumelekile.

Bese kuthi $$A_B = N_1 N_2 N_3 N_4 N_5 N_6 N_7 N_8 N_9 N_{10} N_{11} N_{12} N_{13} N_{14} N_{15} N_{16} N_{17} N_{18} 131400$$ i-BBAN ehlobene (inwetshiwe ngekhodi yezwe enekhodi DE kanye nedijithi yesheke $$00$$ ).

1. Shintsha manje $$N_k$$, kuyinto $$A_B^* = A_B + l \cdot 10^{24-k}$$ nge $$1 \leq k \leq 18$$ futhi $$(-1) \cdot N_k \leq l \leq 9-N_k \wedge l \neq 0$$. Nge $$P = 98 - (A_B \mod 97)$$ kodwa $$P^* = 98 - \left((A_B + l \cdot 10^{24-k}) \mod 97\right)$$. Ngokuvamile kusebenza ku $$a \equiv a' \mod m, b \equiv b' \mod m$$: $$a + b \equiv a' + b' \mod m$$. Nge $$A_B \equiv R_1 \mod 97$$ futhi $$l \cdot 10^{24-k} \equiv R_2 \mod 97$$ kuyinto $$(A_B + l \cdot 10^{24-k}) \equiv R_1 + R_2 \mod 97$$. Kodwa manje sekunjalo $$0 < R_2 < 97$$ futhi kanjalo $$P^* = 98 - (R_1+R_2) \neq 98 - R_1 = P$$ futhi ngalokho $$P_1 \neq P_1^* \vee P_2 \neq P_2^*$$. Lokhu kushiya ushintsho olulodwa kuphela lwedijithi ukusuka $$P$$ ku $$P^* \neq P$$. Lapha kodwa $$N_k$$ ihlala ingashintshiwe, i-checksum iyakhiwa $$P \neq P^*$$.
2. Lawa ma-IBAN amabili alandelayo avumelekile:
\begin{align} A_1 = DE89207300\boldsymbol{\color{red}01}0012345674 \\ A_2 = DE89207300\boldsymbol{\color{red}98}0012345674 \end{align} , ukuthi sikhulise amadijithi amabili ancikene kokuthi $$A_1$$ ngokuthi $$97$$ . Ngaphezu kwalokho, i-IBAN ayisebenzi ngokusemthethweni kuphela, kodwa amakhodi asebhange ayisisekelo athi 20730001 kanye no-20730098 akhona ngempela.
3. Sizama kuqala, $$N_{k_1}$$ futhi $$N_{k_2}$$ ukushintshanisa. Okokuqala ngu $$P = 98 - (A_B \mod 97)$$ njengoba $$P^* = 98 - \left((A_B + l \cdot 10^{24-k_1} - l \cdot 10^{24-k_2}) \mod 97\right)$$ nge $$l = N_{k_2} - N_{k_1}$$ futhi $$1 \leq k_1, k_2 \leq 18$$. Manje kungenxa

$$\begin{array} {|c|c|} \hline k & R = 10^{24-k} \mod 97 \\ \hline 1 & 56 \\ \hline 2 & 25 \\ \hline 3 & 51 \\ \hline 4 & 73 \\ \hline 5 & 17 \\ \hline 6 & 89 \\ \hline 7 & 38 \\ \hline 8 & 62 \\ \hline 9 & 45 \\ \hline 10 & 53 \\ \hline 11 & 15 \\ \hline 12 & 50 \\ \hline 13 & 5 \\ \hline 14 & 49 \\ \hline 15 & 34 \\ \hline 16 & 81 \\ \hline 17 & 76 \\ \hline 18 & 27 \\ \hline \end{array}$$
$$\forall k_1 \neq k_2 \in \left\{ 1, \ldots, 18 \right\} : R_{k_1} \neq R_{k_2}$$. Kanjalo $$P \neq P^*$$. Ngakho kusamele kubhekwe lokho $$P_n$$ futhi $$N_k$$ nge $$1 \leq n \leq 2$$ futhi $$1 \leq k \leq 18$$ uhwebo. Kungenzeka $$P = 98 - (A_B \mod 97)), (R_1 = (A_B \mod 97)$$, $$P^* = 98 - (A_B + (l \cdot 10^{24-k}) \mod 97)$$, $$R_2 = (A_B + (l \cdot 10^{24-k}) \mod 97)$$. Kusukela thina $$A_B$$ nxazonke $$l \cdot 10^{24-k}$$ kufanele sishintshe $$P_1$$ noma $$P_2$$ nxazonke $$-l$$, ngakho $$P$$ nxazonke $$-10^m l$$ nge $$m \in \{0,1\}$$ ushintsho: Khona-ke $$P^* = 98 - R_2$$ kodwa futhi $$P^* = P - 10^m l = 98 - R_1 - 10^m l$$, ngenxa yalokho $$R_2 = R_1 + 10^m l,$$ futhi kanjalo
$$((A_B \mod 97) + (l \cdot 10^{24-k} \mod 97)) \mod 97 = (A_B \mod 97) + 10^m l$$ Nokho, lesi sibalo asifezeki, njengoba umbhalo olandelayo ubonisa:

See the Pen IBAN FORMULA CHECK by David Vielhuber (@vielhuber) on CodePen.

Lokhu kushiya kuphela ukushintshana okungenzeka kwe $$P_1$$ futhi $$P_2$$. Lapha kodwa $$N_k$$ ihlala ingashintshiwe, i-checksum iyakhiwa $$P \neq P^*$$.
4. Lawa ma-IBAN amabili alandelayo avumelekile:
\begin{align*}A_1 = DE\boldsymbol{\color{red}8}\boldsymbol{\color{green}3}20220800\boldsymbol{\color{red}1}000000\boldsymbol{\color{green}0}00 \\ A_2 = DE\boldsymbol{\color{red}1}\boldsymbol{\color{green}0}20220800\boldsymbol{\color{red}8}000000\boldsymbol{\color{green}3}00\end{align*} Nalapha, i-BIC 20220800 ikhona ngempela.
Emuva