Annex 2
ISBT 128 check
character calculation
ISBT 128 donation numbers
utilize check characters based on the ISO 7064 Mod 37, 2 algorithm. This Annex shows
how to calculate the check character for a given number. The calculation is based
on the donation number string excluding the leading '=' symbol and the flag characters.
The steps in the process
are as follows:
- For
each character in the string determine its check value as required by ISO 7064 (see
Table A2.1).
- For
each character determine its weighted check value by multiplying the check value
from (1) by the nth power of 2 where n is the position of the character from the
right-hand end of the string.
- Sum
the weighted check values from (2).
- Find
the modulus 37 value of the sum from (3).
- Subtract
the value obtained in (4) from 38.
- Find
the modulus 37 value of the result of (5). This is the 37,2 check sum.
The calculated check
sum is used to generate both the barcode check characters used in the flag positions
of the ISBT 128 barcode and the eye-readable check character. The barcode check
characters are determined by adding 60 to the check sum. The eye-readable check
character is determined by cross-referencing the checksum to Table A2.1.
Table A2.1 Mapping from characters to ISO 7064 check values
| Char |
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D |
| Value |
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| |
| Char |
E | F | G | H | I | J | K | L | M | N | O | P | Q | R |
| Value |
14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| |
| Char |
S | T | U | V | W | X | Y | Z | * | |
| Value |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | |
Table A2.2 Example of displayed numbers
| Donation number G123 498 654 321 |
| Position from right (n) |
2n |
Character |
ISO7064 value (step 1) |
Weighted value (step 2) |
| 13 |
8192 |
G |
16 |
131072 |
| 12 |
4096 |
1 |
1 |
4096 |
| 11 |
2048 |
2 |
2 |
4096 |
| 10 |
1024 |
3 |
3 |
3072 |
| 9 |
512 |
4 |
4 |
2048 |
| 8 |
256 |
9 |
9 |
2304 |
| 7 |
128 |
8 |
8 |
1024 |
| 6 |
64 |
6 |
6 |
384 |
| 5 |
32 |
5 |
5 |
160 |
| 4 |
16 |
4 |
4 |
64 |
| 3 |
8 |
3 |
3 |
24 |
| 2 |
4 |
2 |
2 |
8 |
| 1 |
2 |
1 |
1 |
2 |
| Step 3 |
|
Sum of weighted values |
|
148354 |
| Step 4 |
|
Sum mod 37 |
|
21 |
| Step 5 |
|
Subtract from 38 |
|
17 |
| Step 6 |
|
Mod 37 |
|
17 |
| ISO 37,2 check sum = |
17 |
| ISBT128 barcode check characters |
77 |
| ISBT128 eye-readable check = |
H |