# Barcode Hacking

Document Sample

```					            Barcode Hacking

by Ralfe Poisson

ralfepoisson@gmail.com      http://www.ralfepoisson.com   10 November 2008
So what exactly is a Barcode?

A barcode is:

an optical machine-readable representation of data
How do Barcodes Work?

1 dimensional symbologies

Data is represented in the line widths of alternating black and
white vertical bars.
2 dimensional symbologies

Data can be represented as patterns of squares, dots,
hexagons and other geometric patterns.
How did this all come about?

1948
Developed at Drexel Institute of Technology (USA)‫‏‬

1950
First usage - Association of American Railroad to identify the
cars............... It never worked.

1966
National Association of Food Chains (USA) used barcodes to
speed up the checkout process.

1969
From then on, it became industry standard - UPC.
1 Dimensional Symbologies
1 Dimensional Symbologies
1 Dimensional Symbologies
2 Dimensional Symbologies
Online Tools

Generators

http://www.tec-it.com/online-demos/tbarcode/barcode-generator.aspx

Decoders

http://zxing.org/w/decode.jspx

http://www.turbulence.org/Works/swipe/barcode_app.html
UPC / EAN Hacking

Format

a b ccccc ddddd e f
a, b      Origin of the product
c, d     Product Code
e, f     check sum (f is optional)‫‏‬

Example

8 0 00570 00425 7
UPC / EAN Hacking

Check Sum Calculation

w : Sum of odd position numbers.
x : Sum of even position numbers and multiply by 3.
y:w+x
z : y % 10

if (z > 0) {z = 10 - z}

z is now your check sum.
UPC / EAN Hacking

But....

Each number (0-9) is encoded using 7 bars. Barcodes use
three sets of characters to represent 0-9 in order to prevent
simple decoding.
UPC / EAN Hacking

Code Set Patterns

These are determined by the supplier code in the begining of
the barcode.
UPC / EAN Hacking

Decoding Example

8 0 00570 00425 7

Code scheme - 8 : ABABBA CCCCCC
w : Even Sum : 8 + 0 + 5 + 0 + 0 + 2 = 15
x : Odd Sum : 0 + 0 + 7 + 0 + 4 + 5 = 16 * 3 = 48
y : 15 + 48 = 63
z : 63 % 10 = 3
3 > 0 therefore
z = 10 - 3
z=7
THE END

www.ralfepoisson.com

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 31 posted: 5/1/2010 language: English pages: 15