A $5 USB dongle blocks ads for 537,000 domains using 50KB of RAM
Instead of storing domain strings, the firmware hashes each of 537,000 ad-blocking domains into a 40-bit value, sorts the table, and binary-searches it at query time. Blocked lookups resolve in about 10 milliseconds.
A $5 microcontroller blocks ads for 537,000 domains using less RAM than a browser tab.
A hacker built ad-blocking firmware for a $5 ESP32 microcontroller that fits 537,000 ad-blocking domains into roughly 50KB of RAM and answers blocked DNS lookups in about 10 milliseconds.
The trick is not storing the domains
Storing 537,000 domain strings directly would blow past what an ESP32 can hold in memory. Instead, the build process downloads one or more public blocklists, deduplicates and strips comments, then hashes each remaining domain into a compact 40-bit value and sorts the resulting table before writing it into the ESP32's flash memory.
How a lookup actually works
When a DNS query arrives, the device hashes the requested hostname using the same function, then runs a binary search against the sorted hash table. A match means the request gets blocked. No match means the query passes through to an upstream resolver. Binary search over a sorted table is what keeps the 10 millisecond response time on hardware this constrained.
Why a build studio cares
This is a clean, general purpose lesson in trading storage for computation on memory-constrained hardware: hash and sort a large lookup table instead of storing it verbatim, and a $5 microcontroller can do what would otherwise need real memory. The same pattern applies well beyond ad-blocking, anywhere a big set membership check needs to run on constrained embedded hardware.
Next step: read Tom's Hardware's coverage for the full build. If you're working on a memory-constrained embedded project with a large lookup problem, write to us at hello@gattyworks.com.