Mod 11 is the name that is given to the hash function that creates the check digit for ISBN numbers.

These check digits can be used by a program to make sure that the ISBN number that has been entered is valid.

Example

Firstly, assign each of the numbers in the ISBN number a weight:

(weight) 10 9 8 7 6 5 4 3 2 (1)
(ISBN)    0 9 0 5 4 3 5 3 8 (9)

Here 9 is the check digit which has a weighting of 1 Then find the sum of all the products:

10 x 0 = 0
9 x 9 = 18
8 x 0 = 0
7 x 5 = 35
6 x 4 = 24
5 x 3 = 15
4 x 5 = 20
3 x 3 = 9
2 x 8 = 16
total = 200

Then divide this total by 11 to find the remainder. In this case it is 2 (200 divided by 11 equals 18 with 2 as a remainder). In Delphi (or Kylix) the function mod (modulus) can be used to find the remainder using the following code:

var_for_remainder:=200 mod 11;

Once the remainder has been found take this away from 11. The result is the check digit. Therefore:

11-2 = 9

9 is the check digit!

To check the ISBN validity you don't need to do the last step. Work out the total (but this time with the check digit included). Divide this total by 11 and you should get no remainder.

And that's the Mod 11 Hash Function!

This node made up of Computer AS notes

Log in or register to write something here or to contact authors.