Download presentation
Presentation is loading. Please wait.
Published byJesus Byrd Modified over 11 years ago
1
1 Cracking the Code Moshe Kam IEEE Educational Activities IEEE TISP workshop in Piura Peru Participant Guide August 2007 Version 001 30 July 2007
2
2 The UPC Code
3
3 The UPC-A Code l UPC version A barcodes (12 digits) l UPC version E shortened version (8 digits) l ISBN-13 barcodes on books l ISSN symbols on non-U.S. periodicals l EAN-13 and EAN-8 are used outside the U.S. l JAN-13 and JAN-8 are used in Japan Vendor number (5) Product number (5) Checksum Digit (1) Prefix (1) A 1 A 2 A 3 A 4 A 5 A 6 A 7 A 8 A 9 A 10 A 11 A 12
4
4 Calculating the Checksum Digit
5
5 Checksum Digit Calculation (A 12 ) l Add the digits in the odd-numbered positions (first, third, fifth, etc.) together and multiply by three l Add the digits in the even-numbered positions (second, fourth, sixth, etc.) to the result l Calculate how much you need to add so that the number become a multiple of 10 l The answer is the checksum digit (A 12 )
6
6 In symbols l Calculate l 3 (A 1 + A 3 + A 5 + A 7 + A 9 + A 11 ) + A 2 + A 4 + A 6 + A 8 + A 10 = S l How much do we have to add to S to make it a multiple of 10 l If S=2 we need to add 8 to make it 10 l If S=17 we need to add 3 to make it 20 l If S=45 we need to add 5 to make it 50
7
7 088542318258
8
8 l Add the digits in odd- numbered positions l SO = 0+8+4+3+8+5 = 28 l Multiply by 3 l SO3 = 28 times 3 =84 l Add the digits in even- numbered positions (but not the 12 th ) l SE = 8+5+2+1+2 = 18 l Add SO3 to SE l S= 84+18 = 102 l How much you need to add so that S become a multiple of 10 l To get to 110 we need to add 8 l So the checksum digit is 8 08854231825 8 08854231825 8 08854231825 8
9
9 025467406387
10
10 l Add the digits in odd- numbered positions l SO = 0+5+6+4+6+8 = 29 l Multiply by 3 l SO3 = 29 times 3 =87 l Add the digits in even- numbered positions (but not the 12 th ) l SE = 2+4+7+0+3 = 16 l Add SO3 to SE l 87+16 = 103 l How much you need to add so that S become a multiple of 10 l To get to 110 we need to add 7 l So the checksum digit is 7 02546740638?
11
11 l Add the digits in odd- numbered positions l SO = 0+5+6+4+6+8 = 29 l Multiply by 3 l SO3 = 29 times 3 =87 l Add the digits in even- numbered positions (but not the 12 th ) l SE = 2+4+7+0+3 = 16 l Add SO3 to SE l 87+16 = 103 l How much you need to add so that the number become a multiple of 10 l To get to 110 we need to add 7 l So the checksum digit is 7 025467406387
12
12 Activity 1 Detect the Fake Products!
13
13 Activity 1: detect the fake products! l You are given four products l Some of them are original l Some of them are cheap imitations l The imitators did not know about calculating the checksum digit properly l Which one of the products are original and which are fake?
14
14 Rolex Watch Wrangler Jeans A DVD Player A Personal Digital Assistant
15
15 Rolex Watch Wrangler Jeans A DVD Player A Personal Digital Assistant
16
16 Watch – authentic or not?
17
17 Jeans – authentic of not?
18
18 PDA – authentic or not?
19
19 DVD Player – authentic or not?
20
20 The UPC bar code as an Error Detecting Code
21
21 The UPC barcode detects single errors l If any one of the digits is corrupted, then there will be an error in the checksum digit calculation and we will know that an error has occurred
22
22 Activity 2 The Checksum Digit
23
23 Activity 2: effect of error on the checksum digit l Use code 088542318258 to draw the value of the checksum digit against all possible values of l A 2 (A 2 = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) l A 3 (A 3 = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
24
24 Value of digit A 2 Value of checksum digit 0 9 0 9
25
25 Value of digit A 3 Value of checksum digit 0 9 0 9
26
26 Activity 3 Properties of the Code
27
27 Activity 3: Answer a few questions… l Based on activity 2 – does it appear that if there is a single error in one of the digits, this code will detect it? l If there is a single error in one of the digits, will this code tell us which digit is wrong? l Prove your answer!
28
28 Activity 3 (continued) l Can this code always distinguish between a single error (an error in one and only one of the digits) and two errors (simultaneous errors in two digits)? l Prove your answer! l Is it possible that two errors will occur simultaneously and we will not be able to detect them using this code? l Prove your answer!
29
29 Error Correcting Code What happens if one of the digits is missing?
30
30 Code: 025467406387 l 025467406387 l 3(0+5+6+4+6+8)+(2+4+7+0+3)=103 l So to complete to 110 we needed 7 l Now suppose the fourth digit (4) is missing (M) l 025M67406387
31
31 Code 025M67406387 l Can we find M? 3(0+5+6+4+6+8)+(2+M+7+0+3)+7= 106+M l We know that the only number that would add to 106 to create the nearest multiple of 10 is 4 l 106 + 4 = 110 l So if the single digit 4 was missing the code can reconstruct it
32
32 Second example: Code 02M467406387 l Can we find M? 3(0+M+6+4+6+8)+(2+4+7+0+3)+7= 95+ 3M l This is harder… l What is the closest multiple of 10? l If it is 100 then 3M=5 l No, because M is not an integer l If it is 110 then 3M=15 and M=5 l If it is 120 then 3M=25 and M is greater than 9 and non-integer
33
33 Second example: Code 02M467406387 l Can we find M? 3(0+M+6+4+6+8)+(2+4+7+0+3)+7= 95+ 3M l This is harder… l What is the closest multiple of 10? l If it is 100 then 3M=5 l No, because M is not an integer l If it is 110 then 3M=15 and M=5 l If it is 120 then 3M=25 and M is greater than 9 and non-integer
34
34 Third example: Code 025467M06387 l Can we find M? 3(0+5+6+M+6+8)+(2+4+7+0+3)+7= 98+ 3M l What is the closest multiple of 10? l If it is 100 then 3M=2 l No, because M is not an integer l If it is 110 then 3M=12 and M=4 l If it is 120 then 3M=22 and M is not an integer
35
35 Third example: Code 025467M06387 l Can we find M? 3(0+5+6+M+6+8)+(2+4+7+0+3)+7= 98+ 3M l What is the closest multiple of 10? l If it is 100 then 3M=2 l No, because M is not an integer l If it is 110 then 3M=12 and M=4 l If it is 120 then 3M=22 and M is not an integer
36
36 Activity 4 Find the Missing Digit
37
37 Activity 4: Find the Missing Digit 014M91293368 0347M1295765
38
38 Transposition Errors
39
39 Transposition error l Transposition error occurs when two adjacent digits interchange places Example l 025467406387 becomes 024567406387 l Does the UPC barcode correct transposition errors?
40
40 Activity 5 Does the Code Correct Transposition Errors?
41
41 Activity 5: Transposition Errors Check whether the UPC barcode detect a transposition error of 4-7, 7-1 and 1-6 in the left-hand side code Check whether the UPC barcode detect a transposition error of 2-7, 7-1, and 1-6 in the right-hand side code WHAT ARE YOUR CONCLUSIONS?
42
42 Summary
43
43 Summary – what have we learnt today? l The history of bar codes l How barcodes are designed and used l Some properties of UPC bar codes l New terms: l Error Detecting Code l Error Correcting Code
44
44 References (1) l Bar Code History Page http://www.adams1.com/pub/russadam/history.ht ml http://www.adams1.com/pub/russadam/history.ht ml l Bar Codes http://inventors.about.com/library/inventors/blbar _code.htm http://inventors.about.com/library/inventors/blbar _code.htm l UPC Bar Code FAQs http://www.makeupcbarcodes.com/UPC-barcode- FAQ/ http://www.makeupcbarcodes.com/UPC-barcode- FAQ/
45
45 References (2) l Free Barcode Image Generator http://www.idautomation.com/java/linearservlet.html http://www.idautomation.com/java/linearservlet.html l Joseph Woodland http://www.mem.drexel.edu/alumni/Joseph_Woodland.php http://www.mem.drexel.edu/alumni/Joseph_Woodland.php l Bar Code Symbologies l http://www.neodynamic.com/Products/BarcodeSysmbologi es.aspx http://www.neodynamic.com/Products/BarcodeSysmbologi es.aspx l Error Detection Schemes l http://www- math.cudenver.edu/~wcherowi/courses/m6409/errschemes. pdf http://www- math.cudenver.edu/~wcherowi/courses/m6409/errschemes. pdf
46
46 References: Wikipedia l http://en.wikipedia.org/wiki/Universal _Product_Code http://en.wikipedia.org/wiki/Universal _Product_Code l http://en.wikipedia.org/wiki/Barcode http://en.wikipedia.org/wiki/Barcode l http://en.wikipedia.org/wiki/Norman_ Joseph_Woodland http://en.wikipedia.org/wiki/Norman_ Joseph_Woodland
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.