check digit schemes jerzy wojdyło southeast missouri state university may 13, 2002

23
Check Digit Schemes Jerzy Wojdyło Southeast Missouri State University May 13, 2002

Upload: prudence-gardner

Post on 30-Dec-2015

223 views

Category:

Documents


1 download

TRANSCRIPT

Check Digit Schemes

Jerzy Wojdyło

Southeast Missouri State University

May 13, 2002

Common Error PatternsType of Error Form Frequency

Single Error a b 60 – 90 %

Omitting/Adding a Digit …xa …x 10 – 20 %

Adjacent Transposition ab ba 10 – 20 %

Twin Errors aa bb 0.5 – 1.5 %

Jump Transposition acb bca 0.5 – 1.5 %

Jump Twin Errors aca bcb < 1 %

Phonetic Errors 1a a0 0.5 – 1.5 %J. Verhoeff, “Error Detecting Decimal Codes”, Mathematical Centre

Tract 29, The Mathematical Centre, Amsterdam, 1969.

POSTNET

• Bar coded digits, 3 short, 2 long, weights 7 4 2 1 0

• www.usps.com• www.framed.usps.com/cpim/ftp/pubs/pub32.pdf• Check equation (for n = 5, 9, 11)

1 2 3 4 5 6 7 8 9 0*

d1 + d2 + d3 + d4 +… + dn + dn+1 ≡ 0 (mod 10)

POSTNET

6 3 7 0 1 3 20

6 3 7 0 1 4 7 1 0 1 30

POSTNET

? 6 3 7 0 1 4 7 1 0 0 1 0 30

POSTNET

Advantages• Detects all single errors,

• Corrects single error (if corrupted digit is known)

• Works for arbitrary length

• Disadvantages• Transposition errors are undetected

UPC

• Bars and 12 digits

UPC = [d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12] w = [3 1 3 1 3 1 3 1 3 1 3 1 ]

• Check equation

• www.uc-council.com/checkdig.htm

• www.upcdatabase.com

UPC · w ≡ 0 (mod 10)

UPC

0 8 8 6 9 8 0 0 4 2 7 2

3 1 3 1 3 1 3 1 3 1 3 1

0 8 24 6 27 8 0 0 12 2 21 2 110

UPC

• Advantages• Detects all single errors

• Corrects single error (if corrupted digit is known)

• Works for arbitrary length

• Disadvantages (does not detect)• Jump transpositions

• Adjacent transpositions ab ba if |a - b| = 5

EAN

• Bars and 13 digits

EAN=[d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13] w =[ 1 3 1 3 1 3 1 3 1 3 1 3 1 ]

• Check equation

• Advantages/disadvantages same as UPC• www.ean-int.org

EAN · w ≡ 0 (mod 10)

EAN

5 9 0 0 0 5 6 0 0 0 5 6 4

1 3 1 3 1 3 1 3 1 3 1 3 1

5 27 0 0 0 15 6 0 0 0 5 18 4 80

Credit CardsCard Type Prefix Length

AMEX34 37 15

VISA 4 13, 16

MASTER CARD 51 - 55 16

DICOVER 6011 16

Diners Club/

Carte Blanche

300 – 30536 38

14

JCB3

21311800

161515

Credit Cards• Check digit algorithm(s)

• MOD 10

• Luhn Formula

• IBM Check

• Permutation Check

• All do the same

• Hans Peter Luhn (1896-1964)• Worked for IBM since 1941

• Example (Excel)

Credit Cards

Position 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Sum

Digit 3 7 1 5 6 1 2 3 4 5 7 1 0 0 8

Weight 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1

Product 3 14 1 10 6 2 2 6 4 10 7 2 0 0 8

Sum of Digits 3 5 1 1 6 2 2 6 4 1 7 2 0 0 8 48

Invalid number, sum not divisible by 10. Sum mod 10 8

Credit Cards

Position 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Sum

Digit 5 3 0 9 0 0 1 2 3 4 5 6 7 8 9 0

Weight 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1

σi(d) 1 3 0 9 0 0 2 2 6 4 1 6 5 8 9 0 56

Invalid number, sum not divisible by 10. Sum mod 10 6

id , i = 1

σi(d) = (0)(124875)(36)(9), i = 2

Credit Cards

• Advantages• Detects all single errors

• Corrects single error (if corrupted digit is known)

• Works for arbitrary length

• Disadvantages (does not detect)• Jump transpositions

• Adjacent transpositions 09 90 and 90 09

Credit CardsPosition 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Sum

Digit 5 3 0 9 0 0 1 2 3 4 5 6 7 8 9 4

Weight 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1

σi(d) 1 3 0 9 0 0 2 2 6 4 1 6 5 8 9 4 60

Valid number Sum mod 10 0

Position 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Sum

Digit 5 3 0 0 9 0 1 2 3 4 5 6 7 8 9 4

Weight 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1

σi(d) 1 3 0 0 9 0 2 2 6 4 1 6 5 8 9 4 60

Valid number Sum mod 10 0

ISBN

• www.ISBN.org

• Ten “digits” and three dashes (-)

d1 d2 d3 d4 d5 d6 d7 d8 d9 d10

d1,…, d9 = {0, 1, …, 9}; d10 ={0, …, 9, X=10}

• Check equation 10

∑ i∙di 0 (mod 11) i =1

ISBN

0 3 8 7 9 7 9 9 3 X

1 2 3 4 5 6 7 8 9 10

0 6 24 28 45 42 63 72 27 100 407

407=11·37

ISBN

• Advantages• Detects all single errors

• Corrects single error (if corrupted digit is known)

• Detects all transposition errors (!!)

• Disadvantages• Works for bounded length (≤ 10)

• Additional symbol X

Other

• US Postal Money Orders• MOD 9 arithmetic

• Airline Tickets• MOD 7 arithmetic

• Electronic Funds Transfer• MOD 10, weights [3 7 1 3 7 1 3 7 1]

• Verhoeff’s Check Digit Scheme• German DM • Dihedral Group D5 multiplication

The End

If you blinked and missed it, go to

www2.semo.edu/jwojdylo/research.htm