QR Conjuring
view this post on our onion site
5 min read

QR Conjuring

I've recently been dabbling in the art of conjuring QR codes. Would you like me to show you?
QR Conjuring

Adventurer, have a moment to spare? I've recently been dabbling in the art of conjuring QR codes. Would you like me to show you? Oh right, of course you want to know why you'd want to do this.

Put simply, it is a quick way of sharing information, especially when you cannot copy/paste within the same device. Sometimes you want to share that information with a companion. For instance many bitcoin wallets use QR codes for sharing addresses. This is a more error resistant method than manually typing in the other party's address. Sometimes you want to share information with the world. For instance, putting a web URL on your business card or a location on your website that can be scanned into a mapping app. Sometimes you might want to copy information from your computer to your mobile device. You could go through something like Telegram or Signal saved messages, but that's adding extra steps.

There are two methods I will present here. The first is using the search engine DuckDuckGo. When you navigate to DDG, simply type
qr code "whatever you want to encode here" and the search engine will produce a QR code that encodes for whatever you wanted.

The second method of qr conjuring involves the linux command line utility QREncode. QREncode let's you create QR codes with whatever information you want and with granular control over the image created. This also means that the information is not being entered into a search engine or stored anywhere. and after you scan the code you can easily delete the image file and ensure it is wiped. While it is not the most secure method, I must confess I have used this method to share passwords from a desktop to a mobile password manager. I will borrowly largely here from this article from HowToGeek.

How to Create QR Codes From the Linux Command Line
QR Codes can do a whole lot more than just take you to a web site. And they’re easy to create on the Linux command line too. We show you how.

After installing the utility with sudo apt install qrencode call the command with qrencode, specify your output filename with the -o command followed by the filename in double quotes and then whatever information you wich to encode, also in double quotes. The simplest version to create a png of the TSB homepage named tsb.png would look like qrencode -o "tsb.png" "https://sovrnbitcoiner.com" .

qrencode -o "tsb.png" "https://sovrnbitcoiner.com"

There are several many other parameters one may use and if you'd like to look through them use the use the command qrencode --help. For our purposes we will only touch on a few. The first is size with -s. This sets the size of the pixels in your image. Pick an integer for this one. The next parameter is the level of error correction with -l. Options are low, medium, quite high, and highest (L, M, Q or H, respectively). This adds in redundancy or error correction so that if part of the image is obscured, the correct information can still be scanned. Higher quality images will necessarily be larger because they are encoding more information. Lastly there is the -t parameter which will allow you to select the type of output, with your options being PNG, PNG32, EPS, SVG, XPM, ANSI, ANSI256, ASCII, ASCIIi, UTF8, or ANSIUTF8. If you put the output filename as a .png, it will default to PNG type, etc.

After declaring these parameters we will type in the information you wish to encode. Each of these has default values and will use those if you do not specify them. Let's put all of this together to conjure a QR code with highest level error-correction which takes you to all of the advice I've given you lately, set for each "pixel" to be a size 6. It would look something like this:

qrencode -s 6 -l H -o "stormcrow.png" "https://sovrnbitcoin.com/author/stormcrow/

At this point I'm sure you're wondering "Stormcrow, where is my QR code?" It is stored in the file stormcrow.png in whatever directory you are currently in. You have created the code, and now you may share the file wherever you wish or open it in whatever image viewer program you normally use. If however, you want to display the code in the terminal, you must replace the filename with - for the output parameter. This will ouput whatever you encoded, but the default PNG value of -t causes this to not look like what we typically think of as QR codes. For that, you'll want to change -t to ANSI. so revisiting our last example, if we want to output a QR code to the terminal window with size and error-correction at their default levels, it would look like

qrencode -t ANSI -o - "https://sovrnbitcoiner.com/author/stormcrow/"

and should give you the following output

If you are a more advanced practitioner of the command line, you can leave off the information to be encoded and qrencode will accept a standard input. This is helpful if you want to pipe output from another command into qrencode. If, for instance you were setting up your Dojo for Whirlpool, and wanted to pass your admin key from the terminal screen you were remotely accessing as a QR to be read by your phone, you might grep the file docker-node.conf for the phrase NODE_ADMIN and pipe the results to qrencode like so

grep NODE_ADMIN docker-node.conf | qrencode -t ANSI -o -

This should give you a qr that when scanned gives the output

NODE_ADMIN_KEY = your-private-key-here

You'll then copy that into your password manager and erase everything before your password. You can read into more depth about qrencode or libqrencode, the library you can embed in your projects to serve up QR codes here

GitHub - fukuchi/libqrencode: A fast and compact QR Code encoding library
A fast and compact QR Code encoding library. Contribute to fukuchi/libqrencode development by creating an account on GitHub.

Well this mug of ale is empty, and you have a lot to think about, so I'll let you be on your way. Where am I off to? Well I'm not sure what business that is of yours, but if you must know, I'm taking a pickaxe and a headlamp wherever it is I may be heading. Until I see you again Adventurer, be well!

Found this post helpful? Consider sending the author a tip