{"repo":"M-Abozaid/esp32-c3-adblock","free":true,"listed":false,"github":"https://github.com/M-Abozaid/esp32-c3-adblock","clone":"git clone https://github.com/M-Abozaid/esp32-c3-adblock.git","description":"Pi-hole-class DNS ad-blocker on a $2 ESP32-C3 (no PSRAM): 537k domains as 40-bit FNV-1a hashes in flash, binary-searched. UDP DNS sinkhole + web dashboard. https://youtube.com/shorts/RaxszOUMi8E?feature=share","language":"C++","stars":641,"topics":["adblocker","arduino","dns","dns-sinkhole","esp32","esp32-c3","iot","pi-hole","platformio"],"license":"MIT","category":"networking-infra","readme_excerpt":"esp32-c3-adblock A Pi-hole-style DNS ad-blocker that runs on a $2 ESP32-C3 — no PSRAM required . 📰 Featured on Tom's Hardware, XDA Developers, and Korben. The trick everyone misses: you don't need to keep the blocklist in RAM. Store the domains as sorted 40-bit hashes in flash and binary-search them. 140,000+ domains fit in 0.7 MB of flash and are matched in 10 ms, using 50 KB of RAM . Why this is interesting Most ESP32 DNS sinkholes load the blocklist (domain strings ) into RAM, so they demand PSRAM. This project stores fixed 5-byte (40-bit) hashes in flash instead: string-in-RAM approach this (hash-in-flash) --- --- --- Hardware ESP32 + PSRAM ( $8) ESP32-C3, no PSRAM ( $2) 141k domains 2.5 MB of RAM 0.67 MB of flash RAM used most of it 50 KB Lookup string compare 18 flash reads ( 10 ms incl. WiFi RTT) Collisions n/a 0 at 141k (1 at 537k) Why 40 bits? It's the sweet spot for this flash budget. Collisions follow the birthday bound — at 141k domains you get 0, at 537k about 1 (i.e. one unlucky domain gets over-blocked). Dropping to 32 bits would save 20% of the flash but cost 7 collisions at 250k; going to 64 bits wastes 3 bytes per domain to solve a problem you don't have. The same trick works on bigger chips — it isn't a C3 workaround. On a 16 MB ESP32-S3 these hashes hold 2.7M domains vs 466k for strings in 8 MB of PSRAM. Hashes in flash beat strings in PSRAM basically everywhere; the C3 just makes it undeniable. Hardware - Any ESP32-C3 board (tested on a C3 SuperMini), 4 ","default_branch":null,"files":null,"tree":[],"storefront":"/r/M-Abozaid","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/M-Abozaid/esp32-c3-adblock/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}