next up previous contents index Search
Next: 0.12.2.1 References Up: 0.12 Data Integrity Previous: 0.12.1.2 References

0.12.2 Weighted Checksums

A weighted checksum works in nearly the same way as a normal checksum. Where a normal checksum is based on the summation of the values in a data range, however, a weighted checksum takes both data value and position into consideration. To do this, each distinct position in the data range is assigned a weight. Each position's weight is multiplied by the value at the position in question to achieve the final terms in the sum. These terms are added and the weighted checksum value is determined based on this summation.

For instance, imagine creating a weighted checksum for telephone numbers in the format 123-456-7890. If we remove the dashes from the numbers we get something that looks like 1234567890. There are ten places in a number of this format. A typical way to assign weights to places is to give the nth place the weight of 7n. Other values, such as powers of nine or powers of four are also used.

place value
0 1
1 7
2 49
3 343
4 2401
5 16807
6 117649
7 823543
8 5764801
9 40353607

Using such a scheme, the phone number 1234567890 would result in the sum:

S = 1*1 + 2*7 + 3*49 + 4*343 + ... + 0*40353607

The weighted checksum would then be calculated in such a way as to yield a meaningful result when added to the weighted sum calculated in the manner described above. Perhaps the summation added to the checksum would have to yield a number evenly divisible by some large prime. Or perhaps the checksum would negate the summation and their combination would result in zero.



 
Scott Gasch
1999-07-09