650 likes | 763 Views
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.
E N D
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
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
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
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."
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 Norman Joseph Woodland
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
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.
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
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
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
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
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 The UPC-A Code A1A2A3A4A5A6A7A8A9A10A11A12 Checksum Digit (1) Prefix (1) Vendor number (5) Product number (5)
Restrictions: Prefix (A1) A1A2A3A4A5A6A7A8A9A10A11A12 • 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
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)
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
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 088542318258
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?
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
Activity 1 Detect the Fake Products!
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?
A Personal Digital Assistant Rolex Watch A DVD Player Wrangler Jeans
A Personal Digital Assistant Rolex Watch A DVD Player Wrangler Jeans
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
This material is for the teacher 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 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 New_A1 = Old_A1 + m
Activity 2 The Checksum Digit
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)
Value of checksum digit 9 Value of digit A2 0 0 9
Value of checksum digit 9 Value of digit A3 0 0 9
Activity 3 Properties of the Code
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!
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!
Error Correcting Code What happens if one of the digits is missing?
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
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
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
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
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