home *** CD-ROM | disk | FTP | other *** search
/ Phoenix Rising BBS / phoenixrising.zip / phoenixrising / misc / mism15.txt < prev    next >
Text File  |  1992-03-04  |  7KB  |  155 lines

  1.  
  2.                  Cracking the Universal Product Code
  3.                               by Count Nibble
  4.                               ---------------
  5.  
  6. Everyone encounters the UPC nowadays.  You know, it's that set of black bars
  7. you see on virtually every product whenever you go to the grocery store, to
  8. buy a book or a magazine, or even to buy software (assuming that you do,
  9. indeed, BUY your software).  Have you ever though of what fun you could have
  10. by altering that little set of black bars?  If you were lucky enough, you might
  11. be able to slip a box of industrial size laundry detergent by that dizzy 16-
  12. year-old girl at the Safeway and have the computer charge you the price of a
  13. pack of Juicy Fruit, or some other such mischief.  Well, to help you in your
  14. explorations of How To Screw Over Others In This Grand Old Computerized World
  15. of Ours, I proudly present HOW TO CRACK TO UPC CODE.  Use the information
  16. contained herein as you will.  You will need the file UPC.PIC, hopefully
  17. available from the same place you found this file.  And so, let's begin:
  18.  
  19. When the lady at the corner market runs the package over the scanner (or
  20. whatever it is they do in your area), the computerized cash register reads
  21. the UPC code as a string of binary digits.  First it finds the "frame bars" - a
  22. sequence of "101" (see A on picture).  There are three sets of frame bars on
  23. any given code...one on either side, and one in the center.  These do nothing
  24. but set off the rest of the data, and are the same on any UPC code.  Next is
  25. the "number system character" digit, which is encoded in leftside code (see
  26. later).  This digit tells the computer what type of merchandise is being
  27. purchased.  The digits and their meanings are:
  28.  
  29.         0       - Ordinary grocery items. Bread, magazines, soup, etc.
  30.         2       - Variable-weight items.  Meats, fruits & veggies, etc.
  31.         3       - Health items.  Aspirin, bandaids, tampons, etc.
  32.         5       - Cents-off coupon.  (Not sure how this works).
  33.  
  34. The next cluster of digits is the manufacturer number, again stored in leftside
  35. code.  THere are five digits here all the time.  Some numbers include 51000 for
  36. Campbell's Soup, 14024 for Ziff-Davis publishing (Creative Computing, A...),
  37. and 51051 for Infocom.  The next five digits (after the frame bars) are the
  38. product/size id number.  The number for "The Hitchhiker's Guide to the Galaxy"
  39. from Infocom is 01191.  These digits are stored in rightside code.  Finally
  40. there is the checksum, in rightside, which will be discussed later.
  41.  
  42. Now, why are there two types of codes, leftside and rightside?  That's so
  43. the person at the checkout counter can slide the thing by the scanner any way
  44. she pleases.  By having different codings for either side the computer can
  45. tell the right value no matter how the digits are read in.  Here are the
  46. codes for the digits 0 through 9:
  47.  
  48.       Digit             Leftside code           Rightside code
  49.         0                  0001101                 1110010
  50.         1                  0011001                 1100110
  51.         2                  0010011                 1101100
  52.         3                  0111101                 1000010
  53.         4                  0100011                 1011100
  54.         5                  0110001                 1001110
  55.         6                  0101111                 1010000
  56.         7                  0111011                 1000100
  57.         8                  0110111                 1001000
  58.         9                  0001011                 1110100
  59.  
  60. The more observant among you may have noticed that Rightside code is nothing
  61. more than logical-NOTed Leftside code, i.e., a 0 in Leftside is a 1 in Right-
  62. side, and vice versa.  Later on we will discuss another type called Reversed
  63. Rightside, in which the binary values in Rightside are reversed, meaning that
  64. 1110100 (9) in Rightside would be 0010111 in Reversed Rightside.  RR is used
  65. only when there is an extra set of codes off to the right of the main code
  66. bars, as with books and magazines.
  67.  
  68. Now we see the hard part: how the checksum digit is encoded.  Let's try working
  69. out the checksum for "Hitchhiker's Guide".
  70.  
  71. First, notice the Number System Character.  Software is considered a Grocery
  72. Item by UPC, so the NSC is 0 (zero).  Next, Infocom's Manufacturer's Number
  73. is 51051, and the game's id number is 01191.  Good enough.  Set together,
  74. these numbers look like this:
  75.  
  76.         0 51051 01191
  77.  
  78. Now, take the digits of the code and write them on alternate lines, odd on one
  79. line, even below, giving this:
  80.  
  81.         0 1 5 0 1 1
  82.          5 0 1 1 9
  83.  
  84. Now add each set of numbers:
  85.  
  86.         0+1+5+0+1+1 = 8
  87.          5+0+1+1+9 = 16
  88.  
  89. Multiply the first number (the ones created by adding the first, third, etc
  90. digits) by three:
  91.  
  92.         8x3 = 24
  93.  
  94. And add that to the result of the other number (second, fourth, etc digits
  95. added together):
  96.  
  97.         24+16=40
  98.  
  99. Subtract this from the next higher or equal multiple of 10 (40 in this case)
  100.  
  101.         40-40=0
  102.  
  103. And the remainder, here 0 (zero), is the checksum digit.
  104.  
  105. Now, what if there's a set of other bars off to the side?  These are encoded
  106. in another format which uses Reversed Rightside (as described above) instead
  107. of standard Rightside.  For books, the sequence is as follows:
  108.  
  109.         Five digits
  110.         Starts with 1011
  111.         If (first digit is even) then
  112.                 sequence is L-RR-L-L-RR
  113.         else
  114.                 sequence is RR-L-L-RR-L
  115.         each digit is separated with 01
  116.  
  117. Therefore, the sequence for 29656 is:
  118.  
  119.         1011 0010011 01 0010111 01 0101111 01 0110001 01 0000101
  120.                2L         9RR        6L         5L         6RR
  121.  
  122. and the sequence for 14032 is:
  123.  
  124.         1011 0110011 01 0100011 01 0001101 01 0100001 01 0010011
  125.                1RR        4L         0L         3RR        2L
  126.  
  127. Naturally, all these bars are run together.  There is no checksum.
  128.  
  129. For magazines, the sequence is even more complex.  There are two digits
  130. in each bar, and the numbers usually run from 1-12, signifying the month.
  131. The first digits are encoded thusly:
  132.  
  133.         L if the digit is 1,4,5,8 or 9 and
  134.         RR if the digit is 2,3,6,7 or 0.
  135.  
  136. The second digit is coded in L if it is even, and RR if it is odd. Therefore,
  137. 06 codes as:
  138.  
  139.         1011 0100111 01 0101111
  140.  
  141. and 11 codes as:
  142.  
  143.         1011 0110011 01 0110011
  144.  
  145. No checksum here, either, and the fields are again separated by 01.
  146.  
  147. Well, that about does it for this explanation of how to crack the UPC codes.
  148. Use this information as you will, and forward any question to THE SPACE BAR,
  149. 505-265-5178, pw:BANZAI.  Enjoy!
  150.  
  151.         - Count Nibble -
  152.  
  153.  
  154. DOWNLOADED FROM P-80 SYSTEMS.....
  155.