Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

calculate european iban with javascript

I have the german "Bankleitzahl" and the account number, now I would like to calculate the corresponding IBAN with javascript, so I don't have to enter my banking-data on an untrustworthy website.

How would I calculate this with javascript on my own client?

like image 465
rubo77 Avatar asked Jun 19 '13 17:06

rubo77


2 Answers

I have found a project in github https://github.com/arhs/iban.js that make checking of IBAN a very easy stuff.

Is something like:

<script src="iban.js"></script>
<script>
    // the API is now accessible from the window.IBAN global object
    IBAN.isValid('hello world'); // false
    IBAN.isValid('BE68539007547034'); // true
</script>

Is licensed under the MIT license so you can check how it do the validation and try to use it to generate your IBAN.

like image 90
PhoneixS Avatar answered Oct 07 '22 13:10

PhoneixS


So, if you want to reconstruct the IBAN code using the different old-style national components at hand, you can use the Wikipedia article as a base. Specifically, a german IBAN is built up as follows:

DEkk bbbb bbbb cccc cccc cc

where

  • kk is the check code
  • bbbbbbbb is the BLZ
  • cccccccccc is the account number

Note: the exact format is country-dependent, the example above is for Germany

Tom's Cafe offers a full JavasScript implementation you can use in your own application, because the check sum calculation is not trivial.

like image 42
fvu Avatar answered Oct 07 '22 14:10

fvu