Make the base 83 encoding optional.

Author: ioistiredCreated Nov 2, 2020Updated Nov 21, 2025
Labelsenhancementalgorithm

Suppose I want to store 80,000 pre-blurred images in my database. `LjIY5?00?bIUofWBWBM{WBofWBj[` is a sample 4×3 blurHash, and is 28 bytes (224 bits) long. Suppose I use a fixed-width data type in my database, so I don't need the first character of the string which encodes the length. If we remove the first character and encode the same blurHash in its equivalent raw bytes, we need only ~10 bytes (73 bits) to encode the hash, saving 1.5 MB on disk for 80,000 images. That may seem like a micro-optimization, especially in an RDBMS which may duplicate data in indexes. You could say I'm just allergic to plaintext formats when a more compact representation would do, and you'd be right :) I still think there's value in this approach though.