Posts  / #POST-252022
REDDIT

Urna Aberta — a clean-room e-voting machine simulator (Python) / um simulador clean-room de urna eletrônica

E
Sep 21, 2026 · 02:04

**EN:** Every election, Brazil replays the same fight about its voting machines — one camp calls it a magic tamper-proof box, the other calls it open fraud. Most of both have read zero lines of code. So I wrote my own.

**Urna Aberta** is a clean-room model — my code, from scratch, from public architecture. The lesson that reshaped it: counting votes is the easy afternoon. All the real engineering lives in the **chain of trust** — run only signed binaries (Ed25519), store each vote without knowing whose it is (vote log shuffled with a CSPRNG, no identity/order metadata), and make any tampering leave a trace (AES-GCM, independent recount). Adversarial test suite included, green CI.

Blunt about scope: **this is not the TSE's code and proves nothing about the real machine.** It's a test bench for the architecture. If this is your field, clone it and show me where I'm wrong.

🔗 [https://github.com/leqmen/urna-aberta](https://github.com/leqmen/urna-aberta)

**PT:** Todo ano o Brasil repete a mesma briga sobre a urna — um lado chama de caixa mágica inviolável, o outro de fraude escancarada. A maioria dos dois nunca leu uma linha de código. Então escrevi a minha.

**Urna Aberta** é um modelo *clean-room* — meu código, do zero, a partir de arquitetura pública. A lição que reorganizou tudo: contar voto é a tarde fácil. A engenharia de verdade mora na **cadeia de confiança** — só rodar binário assinado (Ed25519), guardar o voto sem saber de quem é (registro embaralhado com CSPRNG, sem metadado de identidade/ordem) e fazer qualquer adulteração deixar rastro (AES-GCM, recontagem independente). Suíte de testes adversariais inclusa, CI verde.

Direto sobre o escopo: **não é o código do TSE e não prova nada sobre a urna real.** É um campo de provas pra estudar a arquitetura. Se for da área, clona e me mostra onde eu errei.

Post image