Download presentation

Presentation is loading. Please wait.

Published byJesus Byrd Modified over 2 years ago

1
1 Cracking the Code Moshe Kam IEEE Educational Activities IEEE TISP workshop in Piura Peru Participant Guide August 2007 Version 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

8
8 l Add the digits in odd- numbered positions l SO = = 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 = = 18 l Add SO3 to SE l S= = 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

9

10
10 l Add the digits in odd- numbered positions l SO = = 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 = = 16 l Add SO3 to SE l = 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 ?

11
11 l Add the digits in odd- numbered positions l SO = = 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 = = 16 l Add SO3 to SE l = 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

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 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

25
25 Value of digit A 3 Value of checksum digit

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: l l 3( )+( )=103 l So to complete to 110 we needed 7 l Now suppose the fourth digit (4) is missing (M) l 025M

31
31 Code 025M l Can we find M? 3( )+(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 = 110 l So if the single digit 4 was missing the code can reconstruct it

32
32 Second example: Code 02M l Can we find M? 3(0+M )+( )+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 02M l Can we find M? 3(0+M )+( )+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 M06387 l Can we find M? 3(0+5+6+M+6+8)+( )+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 M06387 l Can we find M? 3(0+5+6+M+6+8)+( )+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 014M M

38
38 Transposition Errors

39
39 Transposition error l Transposition error occurs when two adjacent digits interchange places Example l becomes 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 ml ml l Bar Codes _code.htm _code.htm l UPC Bar Code FAQs FAQ/ FAQ/

45
45 References (2) l Free Barcode Image Generator l Joseph Woodland l Bar Code Symbologies l es.aspx es.aspx l Error Detection Schemes l math.cudenver.edu/~wcherowi/courses/m6409/errschemes. pdf math.cudenver.edu/~wcherowi/courses/m6409/errschemes. pdf

46
46 References: Wikipedia l _Product_Code _Product_Code l l Joseph_Woodland Joseph_Woodland

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google