# Checksum Algorithm

To enter a key or a master key manually, you enter key parts. When you enter a key part, you enter two key part halves and a checksum for the key part. The checksum is a two-digit number you calculate using the key part and the checksum algorithm.

When you enter the key part and the checksum, ICSF calculates the checksum for the key part you entered. If the checksum you enter and the checksum ICSF calculates do not match, you did not enter the key part correctly and should reenter it. When you enter a key part, you need to calculate the checksum. You can use the checksum algorithm that is described in this appendix.

In the checksum algorithm, you use these operations:
• Sum Operation

The addition table in Figure 1 defines the sum operation. The sum of two hexadecimal digits i and j is the entry at the intersection of the column i and the row j. For example, the sum of A and 6 is C.

• Shift Operation

The shift table in Figure 2 defines the shift operation. The shift of digit i is denoted by H(i). For example, the shift of 5 is H(5) = E.

In this description of the algorithm, the two hexadecimal digits of the checksum are represented by P1 and P2 for the set of 32 hexadecimal digits D(1,2,.....,32). The letter i represents the increment.

To calculate the checksum, use this algorithm:
1. Set i = 0, and set P1 and P2 = 0 (hexadecimal).
2. Let P1 = Sum of P1 and D(i + 1). Let P2 = Sum of P2 and D(i + 2).
3. Let P1 = H(P1). Let P2 = H(P2).
4. Let i = i + 2. If i < 32, go to step 2; otherwise, go to step 5.
5. P1 equals the first checksum digit. P2 equals the second checksum digit.