The parameters for the **MOD10** function are as follows:

**Dir 0** = start on right

**Dir 1** = start on left

**Weight 0** = start with 2

**Weight 1** = start with 1

Direction = 0 (right to left) Weight = 0 (start with '2') 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 End here ← ← ← ← ← ← ← ← ← ← ← ← Go this direction ← ← ← ← ← ← ← ← ← ← ← ← Start here Direction = 0 (right to left) Weight = 1 (start with '1') 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 End here ← ← ← ← ← ← ← ← ← ← ← ← Go this direction ← ← ← ← ← ← ← ← ← ← ← ← Start here Direction = 1 (left to right) Weight = 0 (start with '2') 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 Start here → → → → → → → → → → → → Go this direction → → → → → → → → → → → → End here Direction = 1 (left to right) Weight = 1 (start with '1') 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 Start here → → → → → → → → → → → → Go this direction → → → → → → → → → → → → End here

Ucompose uses the Luhn algorithm to calculate the check digit.

http://en.wikipedia.org/wiki/Luhn_algorithm

The following example assumes a weight of **0** and a direction of **0.**(2,1,2,1,... starting from the right)

Account number 0 0 4 1 7 8 0 0 0 0 0 0 0 0 0 1 3 0 3 7 x Weight 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 x Multiply by weight 0 0 4 2 7 16 0 0 0 0 0 0 0 0 0 2 3 0 3 14 x Sum of digits 0 0 4 2 7 7 0 0 0 0 0 0 0 0 0 2 3 0 3 5 = 33 MOD10 check digit = 7 The check digit (x) is obtained by computing the sum of digits then computing 9 times that value modulo 10. In equation form: (33 * 9) mod 10 In algorithm form: Compute the sum of the digits (33). Multiply by 9 (297). The last digit, 7, is the check digit.

## 0 Comments