Checksum
Portuguese bank account identifiers are a good example of how checksums work. They have 21 digits. The first 19 digits identify the bank, branch and account number.  The last two digits are "mod 97" checksum digits based on modular arithmetic. A typical Portuguese bank account number is 0002.0123.12345678901.54. The digits have the following meanings: