Once upon a time … Holy Sepamaria … GC7DCXZ … what have I calculated …
There must be a better way. The banks can do it too.
And once again an adventurous journey to a new function began. The goal was clear: the function should calculate check digits, check numbers for correctness and calculate missing digits.
To better familiarize myself with the topic of check digits, I started with simple numbers: the German tax ID, the UIC, the ISBN and the IMEI. Just numbers, no letters, no special cases. After the first step was successful, I moved on to the next stage: the EAN or GTIN. Again, it was just a simple number, but with different lengths – 8, 12, 13, 14 digits – which had to be recognized and processed. This was also manageable. The next challenge was bold: EURO banknotes and their control number. Here, letters came into play for the first time and two different versions. The first series until 2013 and the second series from 2013, which differ in their structure. But this was also mastered.
So only the final opponent awaited: the IBAN.
Even the first glance at the German and English Wikipedia made me shudder. Standardization my ass. Only the two characters of the country code and the following two check digits were standardized. The rest was left to the nations. And they were inventive:
Country | Format |
AD – Andorra | AD2!n4!n4!n12!c |
… | |
DE – Germany | DE2!n8!n10!n |
… | |
PK – Pakistan | PK2!n4!a16!c |
… | |
XK – Kosovo | XK2!n4!n10!n2!n |
But SWIFT and the IBAN registry didn’t let me down. The only challenge was
- to harmonize the three sources,
- to develop a data model for the structure of the IBAN,
- to type in what felt like 100 country-specific data and
- to develop an algorithm that would cover all these special cases.
But here, too, the devil is in the detail. Because, of course, every nation has its own rules for the sort code and account number. Even if the IBAN is correct, i.e. the check digit matches the character string, it is by no means necessarily valid.
In Germany, for example, there are over 14,000 bank sort codes, all of which have been created according to different standards. And, of course, each bank has its own system for generating account numbers. It’s a good thing that the Bundesbank exists. Here you will not only find biannually updated information on the valid bank codes, but also on the check digit calculation methods.
This would enable a further step to be taken, at least for Germany: checking whether the correct IBAN also stands for a real bank. Only
- these more than 14,000 bank sort codes need to be entered for the GC Wizard and
- generalize the approximately 100 check digit calculation methods for the account number and
- convert them into algorithms.
Good thing it’s Christmas, the nights are long and the weather makes it easy to stay indoors to see if that works in GC Wizard.
The range of functions is slowly growing and a new feature is slowly appearing on the horizon for the next version of the GC Wizard.