A few weird ways of displaying git hashes
Monday, August 7, 2023
I was reading "Real-World Cryptography" and ran across an thought-provoking statement. While talking about why hashes are often represented in hexademical, the author states (emphasis mine):
There are other ways to encode binary data for human consumption, but the two most widely used encodings are hexademical and base64. The larger the base, the less space it takes to display a binary string, but at some point, we run out of human-readable characters.
Well... at what point do we run out of human-readable characters, and what if we used things beyond ASCII?
My first idea was to represent hashes as emoji to get a larger space of human-readable and easily distinguishable glyphs. After that I came up with a few I wanted to try out:
- words, ala passphrases
Here are the three most recent commits in one of my repositories, represented in these different ways.
- 💮👭🏽⚙️🇹🇲🇹🇴🟫🚬🧔 🏼♀️🧍🏽♂👮🏾🧑 🏽❤💋🏾🧝🏼👩 🏽❤💋🏽🥉
- 👮🏻👩🏿🦱🇵🇱🤽🏿♂🐞👩 🏻❤👩🏾🧑💻🏿🏾🐩🧑🏿👩🏾💼🧑🍳⛪
Words (selected from the EFF word list):
- unburned path scrambled demotion awning outpour echo museum iciness payee perish vending account
- ripple wrongly untaken undermine serve handgrip festivity blend bankbook capitol egging outback absolve
- naturist tartly engraver haphazard renovate douche guidable tidiness nuttiness catlike unearth pox abdomen
Personally, I think I like the color one best from a pure visual perspective, but it comes with a lot of accessibility issues. The color space would probably need tuning to make it easier to visually distinguish between hashes, too. I think it's also probably best combined with the hex representation of the hash itself, so we add another layer on top of the existing representations to make things easier to distinguish instead of relying on just one new representation.
At any rate, this was a fun little experiment! This isn't something I would use in a real application, but different ways of representing bits of information are fun to explore. If you've done anything similar I'd love to hear about it.
The code for this post is available in my sketches repo.
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe to the newsletter or use the RSS feed.
Want to become a better programmer? Join the Recurse Center!