barcodes

feb 2026

its been a while since im back writing blogs (now in uni; unfortunatley feel like uni is taking me out like the next garbage truck)

anyways, so i went to those job searching fairs in school this week, and checking in/registering for the event was somehow more pain than getting rejected by HR about my non-existent CV 😭

Registration required not only:

  1. a QR code you needed to get via some event system (which required you to sign up via Google Oauth; specifically your school email - wait, why is this so pain?)

  2. but also your student card (physical)

I'm lucky I brought my card that day, but had to sign up on spot using the email thing; which gave me a QR code that the registration guy used some browser camera-scanner on his laptop to verify.

Not so lucky for the people behind - I held up the queue by like 10 mins to contribute the an already snaking queue.

why is signing up to an event this hard?

cant it just be more smooth?

-

and that's our problem for today.

-

Idea: So if i can just bring my student card and just have a scanner, scan in like a employee card or something - then that's enough, no?

Limitations: No budget for a scanner; would be fun to have; idk what to do for now but that's for later

-

Let's dive into barcodes.

First thing I did - do a quick look at my student card (im sorry, no photos here but do what you can with imagination.

Now, for some preface, I've been organising some events within school as part of the local student club, and if theres any information that's important to the school, its the student ID - to note that the student has indeed joined the event. email is kinda secondary.

Now these bunch of lines are going to be my lunch today. (no lunch but we thrive with this article!! πŸ”₯

-

Barcodes are an interesting thing. There are typically 2 types of barcodes:

  1. 1 Dimensional Barcodes

    1. These refer to linear barcodes - the ones I'm exactly describing right now (yes, just look at the orange photo of the card above); or your closest Heinz Tomato Ketchup bottle barcode.

  2. 2 Dimensional Barcodes

    1. Barcodes on not just the x axis, but the y-axis. But the normies call them QR code.

    2. Examples: Any QR code, Airline Boarding Passes (PDF417)

Because most usage of barcodes are in products, there is a universal product code (UPC) /barcode standard called the 12-digit UPC.

Ok short lore/history time now.

Traditionally, UPC Bar codes consists of:

  1. Start Pattern

  2. Actual Data Characters

  3. Checksum/Check Digits

  4. Close Pattern

This is the usual standard, even across specifications. Since the scope we are looking at today are more at identification/verification passes, then we look at 1D barcode specification specifically for these, aka Code 39 and Code 128.

Code 39

  • A barcode specification defining A-Z,0-9, special characters

  • Has 9 elements - 5 bars and four saces

  • Unlike UPC, code 39 does not have checksums.

  • Its known to take much space

  • Its's start and stop character is denoted with a *

Initially, I thought my student card was running on Code 39. Until I tried to find the * character on my card- none.

So time to look at the other popular specification,

Code 128

  • It has 3 code sets, A,B and C.

    • Think of them as modes

    • A and B mode cover 128 ASCII

    • C is for digits/numbers

In our case, that means only set C is relevant for us, because our student IDs only contain numbers! That makes life so much easier!

  • Each bar and space is either 1 or 4 bars/spacing wide (fixed width)

  • Each character is made of 3 bars and 3 whites - so every six bars and whites is one character.

Obviously, by the time I write this article, its something I've trialed and tested before writing (ahem; completely not writing this on a whim)

Like other specifications above that we briefly mentioned, code 128's format is quite similar in a way:

  1. Start Code/Mode - is it (A/B/C?)

  2. Actual Data

  3. Checksum

  4. Stop Code

    1. Standard pattern in width is 2331112 (but we will get into this soon)

Anyways, I think it'll be much easier to walk you through a sample below.

Let's look at this barcode (portion)

As briefly mentioned above, 6 bars and whites form one character. So here, we have one character.

To read the actual bars, look at the width. Now this is honestly very subjective; if you wanted to, a ruler could also help.

I think at this point, pro-tips that I picked up while reading around + doing this is that: 1) You'll always start on a black 2) Try to view the whole barcode first, then approximate the widths from there.

Lucky for me, i generated one barcode via Excel; which you can learn here. I won't go much into it, but it's an interesting find.

Anyyyways, let's go into the pattern now. First sentence shows our Start Code, and we measure these via the width of the bars/whites. The thinnest bars are 1, and the thickest bars are 3.

Get the width now, converting the width into subjective looking numerals - 211232.

Now take a look at the wiki table as seen below under bar/space >> widths.

From the wiki's barcode widths table for code 128, we see that 211232 stands for Start Code C, and now we know this barcode a mode C code 128 barcode type, very cool. Now we don't have to search other code specifications.

Next, do the same thing for the next few characters, in groups of 6; referring to the barcode widths table once you have it.

Now, once you've gotten the hang of it, you'll realise you will hit the last two 'groups' of 6 bar/space; which the last group even has 7 bar/spaces. Chill. You're on the right track. The one with the 7 bar/spaces is the stop code, while the one before it is the checksum.

Let's look at the checksum first.

[Checksum]

Lastly, the stop code. Previously, I mentioned about how the standard stop pattern is 2331112. I'm not pulling the numbers from nowhere PLEASE.

You should realise now that 2331112 is the exact number you're getting for the stop code, which is interesting cause how are we psychics doing this?? Man, i love cryptography cause of that. (npq is and amazing math equation, rsa is truly cool for that)

-

Its interesting that security doesnt seem to extend much to physical mediums, which is why 2FA is king now. I must say that OT security has been piquing my interest recently, so hopefully one day I get the chance to do some more exploration in that area.

once again, thanks for reading thus far, hope you like this hehe haha i spent on this blog post.

glad to be back,

syk

anyways, we're not gonna end this here, right? watch me cook in next month's post. or something? when i can have the time to LOL πŸ™/pray

Last updated