cracking the code

65
1 Cracking the Code Moshe Kam, VP for Educational Activities A Presentation to IEEE TISP workshop in Piura Peru August 2007 Version 001 29 July 2006

Upload: herman

Post on 25-Feb-2016

30 views

Category:

Documents


0 download

DESCRIPTION

Version 001 29 July 2006. Cracking the Code. A Presentation to IEEE TISP workshop in Piura Peru. Moshe Kam, VP for Educational Activities. August 2007. A Note on Sources. This presentation is based on multiple on-line and other archived sources See bibliography page for a list. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Cracking the Code

1

Cracking the Code

Moshe Kam, VP for Educational Activities

A Presentation to IEEE TISP workshop in Piura Peru

August 2007

Version 001

29 July 2006

Page 2: Cracking the Code

2

A Note on Sources

This presentation is based on multiple on-line and other archived sources

See bibliography page for a list

Page 3: Cracking the Code

3

The History of Bar Codes

Page 4: Cracking the Code

4

Bar Code

A machine-readable representation of information in a visual format on a surface

Using dark ink on white substrate Creating high and low reflectance, which is

converted to 1s and 0s

Used for computer data entry through optical scanners

Barcode readers

Page 5: Cracking the Code

5

History Bernard Silver (1923-1962), a graduate student at

Drexel Institute of Technology in Philadelphia, overheard the president of a local food chain asking one of the deans to undertake research to develop a system to automatically read product information during checkout.

Silver told his friend, Norman Joseph Woodland, about the food chain president's request

Woodland was a twenty seven year old graduate student and teacher at Drexel

The problem fascinated Woodland and he began to work on it

Page 6: Cracking the Code

6

History

Officially, Jordin Johanson, Bernard Silver and Norman Joseph Woodland from Drexel Institute of Technology invented the Bar Code in 1948

Woodland described how he ‘elongated’ the Morse Code on the sand while at the beach to develop the key idea

Applied for patent in 1949 Granted 1952

U.S. patent 2,612,994 "Classifying Apparatus and Method."

Page 7: Cracking the Code

7

Norman Joseph Woodland Born 1921 WWII – Technical

Assistant at the Manhattan Project

BSME, Drexel 1947

Lecturer at Drexel 1948-1949

Joined IBM in 1951

1992 National US Medal of Technology ceremony

Page 8: Cracking the Code

8

First industrial application of automatic identification

Late 1950s: The Association of American Railroad decide to fund automatic identification

1967: optical bar code

October 10, 1967: car labeling and scanner installation begins

1974: 95% of the fleet is labeled Late 1970s: system abandoned

Page 9: Cracking the Code

9

A long road to commercialization 1966-1967

Bar code was not commercialized until 1966

The National Association of Food Chains (NAFC) put out a call to equipment manufacturers for systems that would speed the checkout process.

In 1967 RCA installed one of the first scanning

systems at a Kroger store in Cincinnati

The product codes were represented by "bull's-eye barcodes", a set of concentric circular bars and spaces of varying widths.

Page 10: Cracking the Code

10

A long road to commercialization 1969-1973

1970: “Universal Grocery Products Identification Code (UGPIC)”

1970: The U.S. Supermarket Ad Hoc Committee

on a Uniform Grocery Product Code

1973 the Committee recommended the adoption of the UPC symbol set still used in the USA today

UPC was submitted by IBM and developed by George Laurer

Page 11: Cracking the Code

11

A long road to commercialization 1974

June 1974: one of the first UPC scanner, made by National Cash Register Co., was installed at Marsh's supermarket in Troy, Ohio

June 26, 1974, the first product with a bar code was scanned at a check-out counter

A 10-pack of Wrigley's Juicy Fruit chewing gum

On display at the Smithsonian Institution's National Museum of American History

Page 12: Cracking the Code

12

A long road to commercialization US DoD mandates use

September 1, 1981: the United States Department of Defense adopted the use of Code 39 for marking all products sold to the United States military This system was called LOGMARS

Page 13: Cracking the Code

13

Bar Codes Today

$16-billion-a-year business  600,000 manufacturing companies

5 billion scans a day

UPC codes account for half of today's bar code technology

Page 14: Cracking the Code

14

The UPC Code

Page 15: Cracking the Code

15

The UPC-A Code

UPC version A barcodes (12 digits)

UPC version E shortened version (8 digits)

ISBN-13 barcodes on books

ISSN symbols on non-U.S. periodicals

EAN-13 and EAN-8 are used outside the U.S.

JAN-13 and JAN-8 are used in Japan

Vendor number (5)

Product number (5)

Checksum Digit (1)Prefix (1)

A1A2A3A4A5A6A7A8A9A10A11A12

Page 16: Cracking the Code

16

Restrictions: Prefix (A1)

0, 1, 6, 7, 8, or 9 for most products 2 reserved for local use (store/warehouse), for items

sold by variable weight

3 reserved for drugs by National Drug Code number 4 reserved for local use (store/warehouse), often for

loyalty cards or store coupons

5 reserved for coupons

A1A2A3A4A5A6A7A8A9A10A11A12

Page 17: Cracking the Code

17

The Checksum Digit

Page 18: Cracking the Code

18

Checksum Digit Calculation (A12)

Add the digits in the odd-numbered positions (first, third, fifth, etc.) together and multiply by three

Add the digits in the even-numbered positions (second, fourth, sixth, etc.) to the result

Calculate how much you need to add so that the

number become a multiple of 10 The answer is the checksum digit (A12)

Page 19: Cracking the Code

19

In symbols Calculate 3 (A1+ A3 + A5 + A7 + A9 + A11) + A2+ A4 + A6 + A8 + A10= S

How much do we have to add to S to make it a multiple of 10

If S=2 we need to add 8 to make it 10 If S=17 we need to add 3 to make it 20 If S=45 we need to add 5 to make it 50

Page 20: Cracking the Code

20

088542318258

Page 21: Cracking the Code

21

Add the digits in odd-numbered positions

SO = 0+8+4+3+8+5 = 28

Multiply by 3 SO3 = 28 times 3 =84

Add the digits in even-numbered positions (but not the 12th)

SE = 8+5+2+1+2 = 18

Add SO3 to SE S= 84+18 = 102

How much you need to add so that S become a multiple of 10

To get to 110 we need to add 8

So the checksum digit is 8

08854231825 808854231825 8 08854231825 8

Page 22: Cracking the Code

22

025467406387

Page 23: Cracking the Code

23

Add the digits in odd-numbered positions

SO = 0+5+6+4+6+8 = 29

Multiply by 3 SO3 = 29 times 3 =87

Add the digits in even-numbered positions (but not the 12th)

SE = 2+4+7+0+3 = 16

Add SO3 to SE 87+16 = 103

How much you need to add so that S become a multiple of 10

To get to 110 we need to add 7

So the checksum digit is 7

02546740638?

Page 24: Cracking the Code

24

Add the digits in odd-numbered positions

SO = 0+5+6+4+6+8 = 29

Multiply by 3 SO3 = 29 times 3 =87

Add the digits in even-numbered positions (but not the 12th)

SE = 2+4+7+0+3 = 16

Add SO3 to SE 87+16 = 103

How much you need to add so that the number become a multiple of 10

To get to 110 we need to add 7

So the checksum digit is 7

025467406387

Page 25: Cracking the Code

25

Activity 1

Detect the Fake Products!

Page 26: Cracking the Code

26

Activity 1: detect the fake products!

You are given four products

Some of them are original

Some of them are cheap imitations

The imitators did not know about calculating the checksum digit properly

Which one of the products are original and which are fake?

Page 27: Cracking the Code

27

Rolex Watch

Wrangler Jeans A DVD Player

A Personal Digital Assistant

Page 28: Cracking the Code

28

Rolex Watch

Wrangler Jeans A DVD Player

A Personal Digital Assistant

Page 29: Cracking the Code

29

Watch – authentic or not?

Page 30: Cracking the Code

30

Jeans – authentic of not?

Page 31: Cracking the Code

31

PDA – authentic or not?

Page 32: Cracking the Code

32

DVD Player – authentic or not?

Page 33: Cracking the Code

33

The UPC bar code as an Error Detecting Code

Page 34: Cracking the Code

34

The UPC barcode detects single errors

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

Page 35: Cracking the Code

35

Detecting an error

If there is an error of +m (m>0) in A2 A4 A6 A8

A10 then the checksum digit does not calculate correctly

If is New_A2 = Old_A2 + m where m>0 If the check digit A12 is greater than or equal to m

(Old_A12 ≥ m) New_A12 = Old A12-m

If the check digit A12 is less than m (A12 < m) New_A12 = 10 - (m- Old_A12)

This material is for the teacher

Page 36: Cracking the Code

36

Detecting an error

If there is an error of +m in A1 A3 A5 A7 A9 A11 then the checksum digit does not calculate correctly

If is New_A1 = Old_A1 + m where m>0 If the checksum digit A12 is greater than or equal to 3m

(A12 ≥ 3m) New_A12 = Old A12 - 3m

If the checksum digit A12 is less than 3m (A12 < 3m) New_A12 = 10 - (3m - Old_A12)

This material is for the teacher

Page 37: Cracking the Code

37

New_A1 = Old_A1 + m

Condition Change in A12

Old_A12 ≥ 3m New_A12 = Old A12 - 3m

0 < 3m – Old_A12 ≤10 New_A12 = 10 – (3m – Old_A12)

10 < 3m – Old_A12 ≤20 New_A12 = 20 – (3m – Old_A12)

20 < 3m – Old_A12 New_A12 = 30 – (3m – Old_A12)

This material is for the teacher

Page 38: Cracking the Code

38

Activity 2

The Checksum Digit

Page 39: Cracking the Code

39

Activity 2: effect of error on the checksum digit

Use code 088542318258 to draw the value of the checksum digit against all possible values of

A2 (A2 = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) A3 (A3 = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

Page 40: Cracking the Code

40

Value of digit A2

Value of checksum digit

0

9

0

9

Page 41: Cracking the Code

41

Value of digit A3

Value of checksum digit

0

9

0

9

Page 42: Cracking the Code

42

Activity 3

Properties of the Code

Page 43: Cracking the Code

43

Activity 3: Answer a few questions…

Based on activity 2 – does it appear that if there is a single error in one of the digits, this code will detect it?

If there is a single error in one of the digits, will this code tell us which digit is wrong? Prove your answer!

Page 44: Cracking the Code

44

Activity 3 (continued) 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)?

Prove your answer!

Is it possible that two errors will occur simultaneously and we will not be able to detect them using this code?

Prove your answer!

Page 45: Cracking the Code

45

Error Correcting Code

What happens if one of the digits is missing?

Page 46: Cracking the Code

46

Code: 025467406387

025467406387 3(0+5+6+4+6+8)+(2+4+7+0+3)=103 So to complete to 110 we needed 7

Now suppose the fourth digit (4) is missing (M)

025M67406387

Page 47: Cracking the Code

47

Code 025M67406387 Can we find M?

3(0+5+6+4+6+8)+(2+M+7+0+3)+7=106+M

We know that the only number that would add to 106 to create the nearest multiple of 10 is 4

106 + 4 = 110 So if the single digit 4 was missing the

code can reconstruct it

Page 48: Cracking the Code

48

Second example: Code 02M467406387

Can we find M?3(0+M+6+4+6+8)+(2+4+7+0+3)+7=95+ 3M

This is harder… What is the closest multiple of 10?

If it is 100 then 3M=5 No, because M is not an integer

If it is 110 then 3M=15 and M=5 If it is 120 then 3M=25 and M is greater than

9 and non-integer

Page 49: Cracking the Code

49

Second example: Code 02M467406387

Can we find M?3(0+M+6+4+6+8)+(2+4+7+0+3)+7=95+ 3M

This is harder… What is the closest multiple of 10?

If it is 100 then 3M=5 No, because M is not an integer

If it is 110 then 3M=15 and M=5 If it is 120 then 3M=25 and M is greater than

9 and non-integer

Page 50: Cracking the Code

50

Third example: Code 025467M06387

Can we find M?3(0+5+6+M+6+8)+(2+4+7+0+3)+7=98+ 3M

What is the closest multiple of 10? If it is 100 then 3M=2

No, because M is not an integer If it is 110 then 3M=12 and M=4 If it is 120 then 3M=22 and M is not an integer

Page 51: Cracking the Code

51

Third example: Code 025467M06387

Can we find M?3(0+5+6+M+6+8)+(2+4+7+0+3)+7=98+ 3M

What is the closest multiple of 10? If it is 100 then 3M=2

No, because M is not an integer If it is 110 then 3M=12 and M=4 If it is 120 then 3M=22 and M is not an integer

Page 52: Cracking the Code

52

Activity 4

Find the Missing Digit

Page 53: Cracking the Code

53

Activity 4: Find the Missing Digit

014M91293368

0347M1295765

Page 54: Cracking the Code

54

Answers

Page 55: Cracking the Code

55

Transposition Error

Page 56: Cracking the Code

56

Transposition error Transposition error occurs when two

adjacent digits interchange places

Example 025467406387 becomes

024567406387

Does the UPC barcode correct transposition errors?

Page 57: Cracking the Code

57

Transposition errors

If the digits Ai and Ai+1 are interchanged then the check sum would

change by either: 3Ai + Ai+1 – 3Ai+1– Ai = 2(Ai– Ai+1) or Ai + 3 Ai+1 – Ai+1 – 3Ai = 2(Ai+1 – Ai). Thus, if |Ai– Ai+1| = 5, the change would be ±10

and so, the error would not be detected.

This material is for the teacher

Page 58: Cracking the Code

58

Activity 5

Does the Code Correct Transposition Errors?

Page 59: Cracking the Code

59

Activity 5: Transposition ErrorsCheck 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?

Page 60: Cracking the Code

60

Summary

Page 61: Cracking the Code

61

Summary – what have we learnt today?

The history of bar codes

How barcodes are designed and used

Some properties of UPC bar codes

New terms: Error Detecting Code Error Correcting Code

Page 62: Cracking the Code

62

References (1) Bar Code History Page

http://www.adams1.com/pub/russadam/history.html

Bar Codes http://inventors.about.com/library/inventors/blbar_code.htm

UPC Bar Code FAQs http://www.makeupcbarcodes.com/UPC-barcode-FAQ/

Page 63: Cracking the Code

63

References (2) Free Barcode Image Generator

http://www.idautomation.com/java/linearservlet.html

Joseph Woodland http://www.mem.drexel.edu/alumni/Joseph_Woodland.php

Bar Code Symbologies http://www.neodynamic.com/Products/BarcodeSysmbologi

es.aspx

Error Detection Schemes http://www-math.cudenver.edu/~wcherowi/courses/m6409/e

rrschemes.pdf

Page 64: Cracking the Code

64

References: Wikipedia

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

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

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

Page 65: Cracking the Code

65

Questions or comments?