Skip to content

brhnsfrn/IBANChecker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IBANChecker

IBAN Checker with Modulo 97 Algorithm

Example

Lets take iban number for a Central Bank of the Republic of Turkey and disect the steps.

  1. Move last four to the end

    TR470000100100000350930001 -> 0000100100000350930001TR47

  2. Replace characters with digits

    0000100100000350930001TR47 -> 0000100100000350930001292747

  3. Start iteration over nine digit numbers

    1. N = 000010010, d = N % 97 = 19
    2. N = 19000035093, d = N % 97 = 43
    3. N = 430001292747, d = N % 97 = 1
  4. If d == 1 then valid; otherwise invalid.

The implemention make us of a specialized "iterator" that perform step 1 and 2 without any allocations.