You are on page 1of 12

Cabrera: BARCODE LOGIC

“Barcode Logic”

Mathematics

Intermediate Level

Ricardo Cabrera
6130 Wolcott Ave.
Chicago, Illinois 60636
Lindblom Math & Science
Intermediate: Grade 7
Cabrera: BARCODE LOGIC Page 2

Table of Contents

Acknowledgments…………………………………………………….…..page 3

Abstract………………………………..………………………………….page 4

Purpose ……………….……………………………………………….…..page 5

Introduction and Body……………………………………...….……........page 6 - 8

Conclusion…………………...…………………………………………....page 9

Procedures………………………………………………………………....page 10

References…………………………………....……………………....…....page 11

Acknowledgements
Cabrera: BARCODE LOGIC Page 3

I would like to thank my mom because of a lot of reasons. For one I wouldn't even know

about QED without out my mom telling me about it. My mom had also shown me this format

which I also didn’t know existed. But, I would like to thank my mom for always helping me with

anything I would ever need help with. I would like to thank my teachers at YSP because they

were the ones who shown me how to even do the things in my project for example what a check

digit even is. I would like to thank Ms. Wells for not only being the best math teacher ever but

for giving me the recommendation to get into YSP. Ms.Wells had also got me into math team,

robotics team and MathCon at my previous school overall Ms. Wells is a great teacher. And,

finally, my QED mentor Mr. Calderbank who has guided and reviewed my work as well as

provided feedback that helped me to improve this project.

Abstract
Cabrera: BARCODE LOGIC Page 4

Hey! Did you ever think what you just bought from a shady place like a flea market or online

website could be a bootleg or a fake? Well…. you could check! Now first question you would

ask is how? Well, I'll tell you! You multiply every other number by 2( If the multiplied number

is 2 digits then add them together for example 11 1+1= 2) and then add all the number together

and it should be divisible by the last number. Now if its a credit card same thing just should be

divisible by 10. You can check it right now go ahead I’ll wait. Hey did you do it…… Great, now

you think I’m a wizard!

Purpose
Cabrera: BARCODE LOGIC Page 5

The purpose of my project is to prove how the Luhn algorithm is used to generate the

numbers that we are so familiar with on our credit cards and the barcodes of products that we use

and buy everyday. The LUHN formula is also called modulus 10, and is a simple algorithm used

to validate the number on a credit card or bar code. Having the ability to know how to use the

Luhn formula can help you to avoid purchasing counterfeit merchandise as well as verifying

credit card authenticity prior to accepting them.

Introduction
Cabrera: BARCODE LOGIC Page 6

Barcodes, you use them in your everyday life when you buy stuff, sell things, and even

use them to check the reliability of a seller in a shaddy store. Credit card fraud and “skimming”

happens a lot and affects millions of people each year! It happened to my own dad when he used

his credit card at a gas station. The next day, he received a fraud alert about someone attempting

to use the card that was still in his wallet at a Walmart store many miles from our home. “Credit

card skimming is a type of credit card theft where crooks use a small device to steal credit card

information in an otherwise legitimate credit or debit card transaction. When a credit or debit

card is swiped through a skimmer, the device captures and stores all the details stored in the

card's magnetic stripe. The stripe contains the credit card number and expiration date and the

credit card holder's full name.

Thieves use the stolen data to make fraudulent charges either online or with a counterfeit

credit card ” (Irby, 2018) Often the thieves will print a new card out with their own name on it,

and a fake card number, but with a magnetic strip that contains all of the victims account

information. This card then appears to be there’s, but leaves a victim possibly responsible for the

charges. The victim can be both the card owner, and the store that released the merchandise to

the thief. The original card owner can get out of the charges if their credit card company has

insurance that relieves them of fraudulent charges. However, the business, particularly small

business owners can have a lot to lose when those payments are reversed and the merchandise is

long gone.

Being familiar with the LUHN formula can allow you to validate the card number prior

to scanned the magnetic strip for payment.The Luhn algorithm is based around the principle of

modulo arithmetic and digital roots. The Luhn algorithm uses modulo-10 mathematics. “The

exact mathematical formula for its generation was invented by Hans Peter Luhn, an engineer at
Cabrera: BARCODE LOGIC Page 7

IBM in 1954. Originally the formula was patented, however the algorithm is now in the public

domain and a Worldwide standard ISO/IEC 7812-1” (Barry, 2013) “The LUHN formula, also

called modulus 10, is a simple algorithm used to validate the number on a credit card. It works

on cards issued by all the major credit card companies, including American Express, Visa,

MasterCard, Discover, and Diners Club.” (Rouse, 2006)

Body

Now how does it actually work because most people think it’s randomly generated well

not entirely. They use a formula at the end of the barcode there’s a checks digit. You would

multiply every other number by 2 (mod 10) and then just add up all the number together. The

sum of all the digits should be divisible by the checks digit. If it’s not divisible by the checks

digit then you probably got some bootleg item. An example of what I explained is below:

Example:
5 4 1 2 7 5 1 2 3 4 1 2 3 4 5 6

8 4 0 4 8 4 8 2

5 8 1 4 7 0 1 4 3 8 1 4 3 8 5 2

The box in yellow is our check digit so keep that in mind.


Multiply every other number by 2 starting with the second number.
The5 × 2 = 10 but 10 (mod 10)≡ 0so I wanted to model that. Something similar to this is the
number in pink because 6×2 = 12 but 12 (mod 10) isn’t it’s 2.
Now add all the digits together!
5 + 8 + 1 + 4 + 7 + 0 + 1 + 4 + 3 + 8 + 1 + 4 + 3 + 8 + 5 + 2 = 64
Here’s a question is 64 congruent to 0 (mod 10)?
The checks digit is irrelevant because it’s not a barcode only with barcodes do the check digit
matter otherwise it’s 0 (mod 10).
The answer is no it’s not so this card would be a fake.
Cabrera: BARCODE LOGIC Page 8

Theres other ways of doing this too. For example If you don’t even have a check digit

there’s a way to find it.. First you would double every other digit starting from the first digit by

2. Add up all the numbers now exclude the check digit of course. Multiply that number by 9.

Now use that number in mod 10. And the units digit ( the last number) of the number you have

just gotten is the check digit. If this doesn’t work you probably got a fake credit card or barcode.

I personally prefer the first option I mention because it’s easy to explain and easy to put in a

graph but both option work.

Conclusion

In conclusion, yes, using the Luhn algorithm you can validate the authenticity of both a

credit card number and barcode number by hand without a computer. The Luhn Algorithm is a
Cabrera: BARCODE LOGIC Page 9

very useful thing to know because as the world changes, it’s becoming a more technological

place where it is getting easier to get scammed. Just as a reminder the check digit is the last

number in the barcode/ credit card. It will help you when you are buying something and aren't

sure if its authentic or not. And, it is necessary to begin the checking process at a different

starting point depending on whether you are analyzing a barcode or a credit card. When I first

worked the problems for both barcodes and credit cards, I used the same formula and starting

point, but my findings where coming up inaccurate. That is when I learned that although the

formula is always the same, barcodes are different in the way that you have to multiply starting

with the second number, where as with credit cards you begin with the very first number.

Through research, I found that other number patterns generated with Luhn algorithm include

automobile VIN numbers, ISBN numbers on books and magazines, Australian Tax Numbers,

Hungarian Social Security Numbers, and American bank routing codes. The next direction that I

would pursue for further research or investigation, is applying this to VIN numbers as stolen

automobiles is also a common crime. And also, to combine the algorithm with computer coding.

When combined, a very convenient app can be created and stored on electronic devices for even

easier use.

Procedures
Cabrera: BARCODE LOGIC Page 10

Step 1: Depending on what your checking ( credit card/ barcode) you’ll multiply every other

number by 2. You’ll either multiply every other number starting with the first digit or the second

digit by 2.

Step 2: If the number you multiplied is over 10 then you”ll add the two digits together like: 12

would be 1+2= 3.

Step 3: You’ll Bring down all the other previously unused number to then create one big list of

numbers.

Step 4: Add all of the digits in that list of numbers.

Step 5: Depending on what your checking you’ll either use the checks digit to see if the number

is visible by the checks digit for barcodes or you’ll see if the number is congruent to 0 (mod 10)

for credit cards.

*See diagram within the body for visuals & specific examples

Method of Procedures

Now how does it actually work because most people think it’s randomly generated, well
not entirely. They use a formula at the end of the barcode there’s a checks digit. You would
multiply every other number by 2 (mod 10) and then just add up all the number together. The
sum of all the digits should be divisible by the checks digit. If it’s not divisible by the checks
digit then you probably got some bootleg item. An example of what I explained is below:
Example:
5 4 1 2 7 5 1 2 3 4 1 2 3 4 5 6

8 4 0 4 8 4 8 2

5 8 1 4 7 0 1 4 3 8 1 4 3 8 5 2

The box in yellow is our check digit so keep that in mind.


Cabrera: BARCODE LOGIC Page 11

Multiply every other number by 2 starting with the second number.


The5 × 2 = 10 but 10 (mod 10)≡ 0so I wanted to model that. Something similar to this is the
number in pink because 6×2 = 12 but 12 (mod 10) isn’t it’s 2.
Now add all the digits together!
5 + 8 + 1 + 4 + 7 + 0 + 1 + 4 + 3 + 8 + 1 + 4 + 3 + 8 + 5 + 2 = 64
Here’s a question is 64 congruent to 0 (mod 10)?
The checks digit is irrelevant because it’s not a barcode only with barcodes do the check digit
matter otherwise it’s 0 (mod 10).
The answer is no it’s not so this card would be a fake.

Theres other ways of doing this too. For example If you don’t even have a check digit
there’s a way to find it.. First you would double every other digit starting from the first digit by
2. Add up all the numbers now exclude the check digit of course. Multiply that number by 9.
Now use that number in mod 10. And the units digit ( the last number) of the number you have
just gotten is the check digit. If this doesn’t work you probably got a fake credit card or barcode.
I personally prefer the first option I mention because it’s easy to explain and easy to put in a
graph but both option work.

Bibliography

Berry, N. (2013, July 4). Credit Cards. Retrieved October 28, 2018, from
http://datagenetics.com/blog/july42013/index.html.

IRBY, L. (2018, October 15). How Credit Card Skimming Works: Thieves Use Credit
Card Skimming to Steal Your Data. Retrieved October 28, 2018, from
https://www.thebalance.com/how-credit-card-skimming-works-960773

Margaret Rouse. (2006, October). LUHN formula (modulus 10). Tech Target Network,
Retrieved from https://searchsecurity.techtarget.com/definition/LUHN-formula.
Cabrera: BARCODE LOGIC Page 12

Wikipedia (n.d.). Luhn algorithm. Retrieved from


https://en.wikipedia.org/wiki/Luhn_algorithm

You might also like