Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fault Tolerance CDA 5140 Spring 06 Everyday FT. Background Use of check digits for error detection on everyday applications used extensively but most.

Similar presentations


Presentation on theme: "Fault Tolerance CDA 5140 Spring 06 Everyday FT. Background Use of check digits for error detection on everyday applications used extensively but most."— Presentation transcript:

1 Fault Tolerance CDA 5140 Spring 06 Everyday FT

2 Background Use of check digits for error detection on everyday applications used extensively but most people unaware of it Examples: airline tickets, credit cards, bank accounts, library books, grocery products, drivers’ licenses, passports, rental cars, UPS, express mail, UPC bar codes, etc. Not used for SSNs, telephone numbers & some serial numbers on currency - why not?

3 Universal Product Codes (UPC) First used on groceries, now on most products; some products now have Radio Frequency Identification (RFID) which is much more complicated UPC has 12 digits, a 1, a 2, … a 12 each of which is from the set {0, 1, …, 9} and a 1 is the product type a 2 to a 6 identifies the manufacturer a 7 to a 11 identifies the product a 12 is the check digit In some products a 12 is not printed but is on bar code

4 UPC continued a 12 chosen such that: (a 1 a 2 a 3 …a 12 )(3 1 3 1 3 1 3 1 3 1 3 1) = 3a 1 + a 2 + 3a 3 + … + a 12 = 0 (mod 10)

5 Example: Kellogg product

6 2nd Kellogg Product

7 Nutri Grain Product Different manufacturer

8 UPC Examples Note for all 3 products that first digit is “0” indicating a household product First 2 products from same manufacturer, so next 5 digits same (38000) but 3rd is different manufacturer so different digits (16000) First 2 products are different, so different next 5 digits distinct (66330 and 01302)

9 UPC examples To determine if first example is a valid code, calculate 3(0) + 1(3) + 3(8) + 1(0) + 3(0) + 1(0) + 3(6) + 1(6) + 3(3) + 1(3) + 3(0) + 1(7) = 70 = 0(mod 10) This code is able to detect any single error, for example, typed in incorrectly. Assume a digit a i is incorrectly entered as a i ’ and if this were not detected, then would have:

10 UPC example continued (a 1 a 2 a 3 …a i … a 12 )(3 1 3 1 3 1 3 1 3 1 3 1) = 0 (mod 10) (a 1 a 2 a 3 …a i ’…a 12 )(3 1 3 1 3 1 3 1 3 1 3 1)=0 (mod 10) Thus ((a 1 a 2 a 3 …a i …a 12 ) - (a 1 a 2 a 3 …a i ’…a12))(3 1 3 1 3 1 3 1 3 1 3 1) = 0 which implies either (a i - a i ’) = 0 or 3 (a i - a i ’) = 0 (mod 10) which is a contradiction, and hence a single error must be detected

11 Version E UPC Used for special products such as round soda cans, small items, magazines Only 8 digits long Uses one of 4 formulae depending on last non-check digit –If a 7 is {0, 1, 2} then a 8 is such that (3 1 3 3 1 3 1 1)(a 1 a 2 a 3 …a 8 ) = 0 (mod 10)

12 Version E UPC cont’d If a 7 is {3} then a 8 is chosen such that (3 1 3 1 1 3 0 1) )(a 1 a 2 a 3 …a 8 ) = 0 (mod 10) If a 7 is {4} then a 8 is chosen such that (3 1 3 1 3 3 0 1)(a 1 a 2 a 3 …a 8 ) = 0 (mod 10) If a 7 is {5,6,7,8,9} then a 8 is chosen such that (3 1 3 1 3 1 3 1)(a 1 a 2 a 3 …a 8 ) = 0 (mod 10)

13 Version E UPC Example New Yorker Magazine Since a 7 is 9, use (3 1 3 1 3 1 3 1)

14 Other UPC Versions Shipping container version has 2 check digits, one comparable to standard, other using modulus 103 European countries have 13-digit version, weight vector (1 3 1 3... 1 3 1) with 2 digits ahead of the manufacturer’s number to identify the country

15 Credit Card Methods IBM developed more complex system for use with credit cards, libraries, blood banks, some vehicle agencies, etc. Use permutation  that maps as:  (0) = 0  (1) = 2  (2) = 4  (3) = 6  (4) = 8  (5) = 1  (6) = 3  (7) = 5  (8) = 7  (9) = 9

16 Credit Card Method For any string of digits (a 1 a 2 a 3... a n-1 ), n even, check digit a n is set such that  (a 1 ) + a 2 +  (a 3 ) + a 4 +... +  (a n-1 ) + a n = 0 (mod 10) For n odd, apply  to even numbered positions. Consider a VISA ad with card number 4417 1234 5678 9122 - is this valid?

17 Error Detection for UPC & Credit Card Schemes Both schemes can detect all single digit errors. Common error of transpositions of two digits where …ab… becomes …ba… is not detected by UPC code if |a-b| = 5, and not by IBM code if |a-b| = 9 For UPC code, why is this true? So, for the 90 such possible transpositions for UPC code, all except 05, 16, 27, 38, 49 and reversals are detected, & for IBM not 90 or 90

18 Increased Detection Ability Next to 2-digit transformation, most common transformation is jump transformation which changes …abc… into …cba…, e.g....6163… to...6361... Neither of UPC or IBM schemes would detect these A weight vector of (7 3 9 7 3 9 7 3) is used with 8- digit number mod 10 by banks & many western countries for passport to detect such errors, others use (7 3 1 7 3 1 …) Both schemes detect jumps if |a-c| is not 5

19 Increased Detection cont’d Other classes of errors detected depending on the 3 weights used –for example …aca… to …bcb…, or, …aa… to …bb… can be detected with the proper choice of weights 4-weight schemes increase percentage of errors detected but order of weights becomes very important –for example, if weights are 1, 3, 9, 7, then we have 1a + 3c + 9a = 10a + 3c = 3c (mod 10) and 1b +3c + 9b = 10b + 3c = 3c (mod 10) So error not detected. What if change weights to 1, 3, 7, 9?

20 Other Modulus Schemes All previous schemes were modulus 10. Scheme for ISBN (book) numbers is mod 11 & detects all single errors and transposition errors. 9-digit number and one check digit, (a 1 a 2 a 3 …a 10 )with weight vector (10 9 8 7 6 5 4 3 2 1) gives: (a 1 a 2 a 3 …a 10 )(10 9 8 7 6 5 4 3 2 1) = 0 (mod 11) if a 10 is 10 then it is written as “X” Our text has ISBN number 0-471-29342-3 and sums to 187 = ?

21 Other Modulus Schemes Various schemes developed to avoid use of X but not as well known as ISBN. Most common error is single digit but many schemes don’t cover such as choice is based on simplicity, e.g. USPS money orders, FedEx, UPS packages simply assign check digits based on mod 9 or 7

22 Other Modulus Schemes Airline companies, FedEx, UPS divide number by 7 & take remainder as check digit For example, UPS number 601 399 957 divided by 7 gives a remainder of 4 so on the package is: 601 399 957 4 division by 7 not as effective at detecting single errors but is fairly effective at detecting transpositions

23 Alphanumeric Schemes Include alphanumeric characters, for example the “3-out-of-9” code or 39 Code, allows digits {0, 1, … 9} and letters {A, B, …, Z} and characters - and. and space, used by DoD, automotive and health industries Letters assigned numbers 10 through 35, and other 3 characters, 36,37 and 38 respectively Multiply (a 1 a 2 a 3 …a n )(n n-1 … 3 2 1) mod 39 and take remainder as check digit, converted to alphanumeric if necessary Can add $,/,+,% as 39 through 42 to detect all single digit errors & all transposition errors

24 Error Correcting Approaches Some schemes add second check digit to give more ‘power’ Example: Norwegian citizen registration numbers with 9 digits plus 2 check digits calculated as: (a 1 a 2 a 3 …a 10 )(3 7 6 1 8 9 4 5 2 1) = 0 (mod 11) (a 1 a 2 a 3 …a 11 )(5 4 3 2 7 6 5 4 3 2 1) = 0 (mod 11) Detects all single digit errors and all double errors except those where difference between correct version & incorrect one is of form (0 0 0 a 0 0 0 0 0 11-a 0) Why?

25 Error Correcting Numbers such that check digits would be “10” not used More powerful version detects all double errors and corrects all single errors The information is 8 digits and check is 2 digits: (a 1 a 2 a 3 …a 10 )(1 1 1 1 1 1 1 1 1 1) = 0 (mod 11) (a 1 a 2 a 3 …a 10 )(1 2 3 4 5 6 7 8 9 10) = 0 (mod 11) Note that omitting numbers with check digit ‘10’ still gives over 82 million numbers.

26 Error Correcting First calculation determines magnitude m of any single error, since if there were no errors, sum would be 0 modulus 11 Second calculation, assuming single error, will then identify position i of error since if sum s is non-zero, have mi = s, so determine that position i is too large by m (use modulus properties to get an even multiple of i) Thus, knowing magnitude & position, single error can be corrected.

27 Error Correcting Given 8 information digits 73245018 can calculate a 9 and a 10 (7 3 2 4 5 0 1 8 a 9 a 10 )(1 1 1 1 1 1 1 1 1 1) = 7 + 3 + 2 + 4 + 5 + 1 + 8 + a 9 + a 10 = 30 + a 9 + a 10 = 8 + a 9 + a 10 = 0 (mod 11) (7 3 2 4 5 0 1 8 a 9 a 10 )(1 2 3 4 5 6 7 8 9 10) = 7 + 6 + 6 + 16 + 25 + 7 + 64 + 9a 9 + 10a 10 = 131 + 9a 9 + 10a 10 = 10 + 9a 9 + 10a 10 = 0 (mod 11) 2 equations in 2 unknowns - what are values of a 9 and a 10 ?

28 Summary Various schemes discussed have many uses when used to detect errors Techniques based on Number Theory properties and used sum of zero but any digit could be used Techniques likely to be extended to much more powerful but simple-to-calculate schemes


Download ppt "Fault Tolerance CDA 5140 Spring 06 Everyday FT. Background Use of check digits for error detection on everyday applications used extensively but most."

Similar presentations


Ads by Google