{"id":14168,"date":"2023-03-21T03:05:02","date_gmt":"2023-03-21T02:05:02","guid":{"rendered":"https:\/\/www.graviton.at\/letterswaplibrary\/some-rough-information-on-decoding-bar-codes\/"},"modified":"2023-03-21T03:05:02","modified_gmt":"2023-03-21T02:05:02","slug":"some-rough-information-on-decoding-bar-codes","status":"publish","type":"post","link":"https:\/\/www.graviton.at\/letterswaplibrary\/some-rough-information-on-decoding-bar-codes\/","title":{"rendered":"Some Rough Information On Decoding Bar Codes"},"content":{"rendered":"<p>\ufffd\t\t     Cracking the Universal Product Code<br \/>\n\t\t\t      by Count Nibble<br \/>\n\t\t\t      &#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>  Have you ever though of what fun you could have by altering that little set of<br \/>\nblack bars?  If you were lucky enough, you might be able to slip a box of<br \/>\nindustrial size laundry detergent by that dizzy 16- year-old girl at the Safeway<br \/>\nand have the computer charge you the price of a pack of Juicy Fruit, or some<br \/>\nother such mischief.  Well, to help you in your explo\ufffdrations of How To Screw<br \/>\nOver Others In This Grand Old Computerized World of Ours, I proudly present HOW<br \/>\nTO CRACK TO UPC CODE.  Use the information contained herein as you will.  You<br \/>\nwill need the file UPC.PIC, hopefully available from the same place you found<br \/>\nthis file.  And so, let&#8217;s begin:<\/p>\n<p>  When the lady at the corner market runs the package over the scanner (or<br \/>\nwhatever it is they do in your area), the computerized cash register reads the<br \/>\nUPC code as a string of binary digits.\tFirst it finds the &#8220;frame bars&#8221; &#8211; a<br \/>\nsequence of &#8220;101&#8221; (see A on picture).  There are three sets of frame bars on any<br \/>\ngiven code&#8230;one on either side, and one in the center.  These do nothing but<br \/>\nset off the rest of the data, and are the same on any UPC code.  Next is the<br \/>\n&#8220;number system character&#8221; digit, which is encoded in leftside code (see later).<br \/>\nThis digit tells the computer what type of merchandise is being purchased.  The<br \/>\ndigits and their meanings are:<\/p>\n<p>\t0\t&#8211; Ordinary grocery items. Bread, magazines, soup, etc.<br \/>\n\t2\t&#8211; Variable-weight items.  Meats, fruits &amp; veggies, etc.<br \/>\n\t3\t&#8211; Health items.  Aspirin, bandaids, tampons, etc.<br \/>\n\t5\t&#8211; Cents-off coupon.  (Not sure how this works).<\/p>\n<p>  The next cluster of digits is the manufacturer number, again stored in<br \/>\nleftside code.\tTHere are five digits here all the time.  Some numbers include<br \/>\n51000 for Campbell&#8217;s Soup, 14024 for Ziff-Davis publishing (Creative Computing,<br \/>\nA&#8230;), and 51051 for Infocom.  The next five digits (after the frame bars) are<br \/>\nthe product\/size id number.  The number for &#8220;The Hitchhiker&#8217;s Guide to the<br \/>\nGalaxy&#8221; from Infocom is 01191.  These digits are stored in rightside code.<br \/>\nFinally there is the checksum, in rightside, which will be discussed later.<\/p>\n<p>  Now, why are there two types of codes, leftside and rightside?  That&#8217;s so the<br \/>\nperson at the checkout counter can slide the thing by the scanner any way she<br \/>\npleases.  By having different codings for either side the computer can tell the<br \/>\nright value no matter how the digits are read in.  \ufffd Here are the codes for the<br \/>\ndigits 0 through 9:<\/p>\n<p>      Digit\t\tLeftside code\t\tRightside code<br \/>\n      &#8212;&#8211;\t\t&#8212;&#8212;&#8212;&#8212;-\t\t&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\t0\t\t   0001101\t\t   1110010<br \/>\n\t1\t\t   0011001\t\t   1100110<br \/>\n\t2\t\t   0010011\t\t   1101100<br \/>\n\t3\t\t   0111101\t\t   1000010<br \/>\n\t4\t\t   0100011\t\t   1011100<br \/>\n\t5\t\t   0110001\t\t   1001110<br \/>\n\t6\t\t   0101111\t\t   1010000<br \/>\n\t7\t\t   0111011\t\t   1000100<br \/>\n\t8\t\t   0110111\t\t   1001000<br \/>\n\t9\t\t   0001011\t\t   1110100<\/p>\n<p>  The more observant among you may have noticed that Rightside code is nothing<br \/>\nmore than logical-NOTed Leftside code, i.e., a 0 in Leftside is a 1 in Right-<br \/>\nside, and vice versa.  Later on we will discuss another type called Reversed<br \/>\nRightside, in which the binary values in Rightside are reversed, meaning that<br \/>\n1110100 (9) in Rightside would be 0010111 in Reversed Rightside.  RR is used<br \/>\nonly when there is an extra set of codes off to the right of the main code bars,<br \/>\nas with books and magazines.<\/p>\n<p>  Now we see the hard part:  how the checksum digit is encoded.  Let&#8217;s try<br \/>\nworking out the checksum for &#8220;Hitchhiker&#8217;s Guide&#8221;.<\/p>\n<p>  First, notice the Number System Character.  Software is considered a Grocery<br \/>\nItem by UPC, so the NSC is 0 (zero).  Next, Infocom&#8217;s Manufacturer&#8217;s Number is<br \/>\n51051, and the game&#8217;s id number is 01191.  Good enough.  Set together, these<br \/>\nnumbers look like this:<\/p>\n<p>\t0 51051 01191<\/p>\n<p>  Now, take the digits of the code and write them on alternate lines, odd on one<br \/>\nline, even below, giving this:<\/p>\n<p>\t0 1 5 0 1 1<br \/>\n\t 5 0 1 1 9<\/p>\n<p>Now add each set of numbers:<\/p>\n<p>\t0+1+5+0+1+1 = 8<br \/>\n\t 5+0+1+1+9 = 16<\/p>\n<p>  Multiply the first number (the ones created by adding the first, third, etc<br \/>\ndigits) by three:<\/p>\n<p>\t8&#215;3 = 24<\/p>\n<p>  And add that to the result of the other number (second, fourth, etc digits<br \/>\nadded together):<\/p>\n<p>\t24+16=40<\/p>\n<p>Subtract this from the next higher or equal multiple of 10 (40 in this case)<\/p>\n<p>\t40-40=0<\/p>\n<p>And the remainder, here 0 (zero), is the checksum digit.<\/p>\n<p>  Now, what if there&#8217;s a set of other bars off to the side?  For books, the<br \/>\nsequence is as follows:<\/p>\n<p>\tFive digits<br \/>\n\tStarts with 1011<br \/>\n\tIf (first digit is even) then sequence is L-RR-L-L-RR<br \/>\n      \ufffd else sequence is RR-L-L-RR-L<br \/>\n\teach digit is separated with 01<\/p>\n<p>Therefore, the sequence for 29656 is:<\/p>\n<p>\t1011 0010011 01 0010111 01 0101111 01 0110001 01 0000101<br \/>\n\t       2L\t  9RR\t     6L \t5L\t   6RR<\/p>\n<p>and the sequence for 14032 is:<\/p>\n<p>\t1011 0110011 01 0100011 01 0001101 01 0100001 01 0010011<br \/>\n\t       1RR\t  4L\t     0L \t3RR\t   2L<\/p>\n<p>Naturally, all these bars are run together.  There is no checksum.<\/p>\n<p>  For magazines, the sequence is even more complex.  There are two digits in<br \/>\neach bar, and the numbers usually run from 1-12, signifying the month.\tThe<br \/>\nfirst digits are encoded thusly:<\/p>\n<p>\tL if the digit is 1,4,5,8 or 9 and<br \/>\n\tRR if the digit is 2,3,6,7 or 0.<\/p>\n<p>  The second digit is coded in L if it is even, and RR if it is odd.  Therefore,<br \/>\n06 codes as:<\/p>\n<p>\t1011 0100111 01 0101111<\/p>\n<p>and 11 codes as:<\/p>\n<p>\t1011 0110011 01 0110011<\/p>\n<p>No checksum here, either, and the fields are again separated by 01.<\/p>\n<p>Well, that about does it for this explanation of how to crack the UPC codes.<\/p>\n<p>Use this information as you will, and forward any question to THE SPACE BAR,<br \/>\n505-265-5178, pw:BANZAI.  Enjoy!<\/p>\n<p>\t&#8211; Count Nibble &#8211;<\/p>\n<div class='watch-action'><div class='watch-position align-right'><div class='action-like'><a class='lbg-style1 like-14168 jlk' href='javascript:void(0)' data-task='like' data-post_id='14168' data-nonce='65e0e39b87' rel='nofollow'><img class='wti-pixel' src='https:\/\/www.graviton.at\/letterswaplibrary\/wp-content\/plugins\/wti-like-post\/images\/pixel.gif' title='Like' \/><span class='lc-14168 lc'>0<\/span><\/a><\/div><\/div> <div class='status-14168 status align-right'><\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>\ufffd Cracking the Universal Product Code by Count Nibble &#8212;&#8212;&#8212;&#8212;&#8212; Have you ever though of what fun&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[27],"class_list":["post-14168","post","type-post","status-publish","format-standard","hentry","category-othernonsense","tag-english","wpcat-7-id"],"_links":{"self":[{"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/posts\/14168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/comments?post=14168"}],"version-history":[{"count":1,"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/posts\/14168\/revisions"}],"predecessor-version":[{"id":14169,"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/posts\/14168\/revisions\/14169"}],"wp:attachment":[{"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/media?parent=14168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/categories?post=14168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.graviton.at\/letterswaplibrary\/wp-json\/wp\/v2\/tags?post=14168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}