"To anyone who finds out how the control figures for Banco Santander's accounts are calculated, I would give it a great score." Thus ended a professor of Applied Abstract Algebra in one of his classes when he was in his final year of his degree. But before we reveal how that story ended, we need to clarify the following: what are the control figures?
Control digits are numbers (sometimes letters) that match certain data, such as ID, barcodes, checking account numbers, or book ISBNs. The purpose of this is to control the veracity of the data, that is, they are verifying elements.
These numbers are obtained as a result of a mathematical operation that occurs with the associated numbers. For security reasons, this operation is usually secret, but can be deciphered with somewhat advanced mathematical methods.
The closest example of the use of control digits is in the National Identity Card (DNI). The ID card, which is in principle completely random, is only a check digit entered for security reasons. If we write a fake ID or make a mistake when entering a number, it is likely that the letter does not match what it should be and thus the falsity of the document is detected.
To calculate the letter on the DNI we divide the corresponding number (8 digits without letters) by 23 and then we take the remaining parts of that division. For example, the ID number is 12345678, if we divide by 23, we have to do: 12345678 = (23 x 536768) + 14
So the rest of the division is 14th. The rest will always be between 0 and 22.
And so it is possible to have the letter Z corresponding to the DNI of the number 12345678.
Imagine that you are transferring to an account number and making a mistake when entering a digit; this could happen because current accounts are not exactly short. Failure can surely lead to sending money to someone you don’t know, which can lead to losing money. But don’t be afraid, because math comes to the rescue to avoid such an embarrassing situation.
Current accounts have several numbers with control digits and, as in the case of the DNI, a secret account is obtained. Using these numbers, before 2 and now 4, makes it difficult to create fake account numbers (not corresponding to a real account) and also has the advantage that it allows us to detect errors when writing an account number.
Therefore, if you make a mistake while entering an account number, it is likely that the control figures for that account do not correspond to them, so your error can be detected and no transfer will be made.
There are mathematical tools that, in addition to detecting that an error has occurred, allow you to identify and correct the error that has been made. It sounds like magic but the truth is, it’s just math. These are what are known as error detection codes.