home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit v2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / Texts / crackupc.txt < prev    next >
Text File  |  1999-11-04  |  7KB  |  160 lines

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