Inspiration

I joined the linguistics club this year because I'm interested in getting into natural language processing and understand how an understanding of the fundamentals of language could help me in that aspect. While there, I was told that the idea of converting numbers or other words/objects into barcodes counts as language which I thought was really interesting. In high school I created a barcode generator on my calculator, but had never attempted QR codes due to their extremely increased complexity. That said, the professor in charge of the linguistics club is going to be hosting a linguistics challenge in the upcoming weeks and has been looking for challenging puzzles to give to the students. I created a barcode puzzle and had joked at the time that I could make a QR code puzzle to really stump the students. I had initially had 3 other teammates and it was actually a friend of mine that told me about this competition and gotten me excited to go, we had plans to use image recognition to find the middle prices of trading cards to aid in card trading amongst peers, but all that fell apart when on Thursday one of the teammates decided they didn't want to come anymore and soon after the other two bailed ship as well. Recognizing that I couldn't tackle developing convolutionary neural networks and networking api's by myself I decided to tackle something more in my league. Hence, the QR code generator, but not just any QR code generator, here lies source code for a hand crafted (from scratch) QR code generator, that breaks the standard limit of 3000 characters leading to limitless possibilities, using nothing but native C#, implementing an easily reusable api in the form of a DLL and a handy windows-form application for quick and dirty usage.

What it does

The main executable is pretty simple to use, there's a text box for typing in your message to be encoded, or you can select File>Import to select a text file to use as your source instead, once the text field changes the code leaps into action and forms a QR code for the data you supply. Now a precaution, the text field has a character limit of 50k, but text files do not, use files if you want a really big code.

How I built it

The first 6 hours of the challenge were spent setting up a class hierarchy to abstract the process of storing the boolean data of the QR code, how to format the data streams, encodings, etc... Then I researched how the data is actually laid out in symbol, which is incredibly complex (I spent at least 2 hours trying to figure out how to use a BCH error correction code). Then it was a matter of tackling the major obstacle of the process which was creating a boolean matrix that could contain all of the dots of the symbol, that way when it came to drawing it on the screen it was simply a matter of iteration.

Challenges I ran into

Data on QR code encoding is extremely vague and if not hard to find, I immediately ran into problems trying to figure out how to format the data streams for binary encoding (which direction the dots go) how to calculate the error masks, patterns, and the overall formatting of even the permanent sections (ie the 3 corner blocks and the smaller blocks that iterate every 22 squares in a grid like fashion over the entire code). Because the QR code itself is proprietary, it's not hard to find online generators for it, but finding the actual method for how those generators work is something else entirely (unless of course I wanted to fork over $200 to ISO so I could see the standard they printed, which wasn't gonna happen).

Accomplishments that I'm proud of

I FINISHED!!! Several times I wanted to walk away and give up but I kept at it throughout the entire process and suprised myself several times being able to figure out problems that seemed impossibly daunting (like how to zig-zag the data encoding across the symbol in reverse order, or determing how big the image needed to be when the artifacts in the image depended on how big the image was)

What I learned

I learned everything there is to know about encoding a QR code.

What's next for Unleashed QR Code Generator

Built With

Share this project:

Updates