A real cryptographic pipeline in Eskiu
The workload
Mexico's INE voter credential carries two QR codes that pack 18 biographical fields plus the credential photo behind a seven-layer cryptographic pipeline: multiple rounds of AES-256-CBC keyed off values derived at runtime, RSA-8192 block decryption, a base64 stage, and a 6-bit text unpacker. Decoding one starts from a photo of the card: detect and read the two QR payloads, then run the whole pipeline to recover the fields and rebuild the photo. It is a compact but unforgiving mix of image handling, real cryptography, and byte-exact bit manipulation, exactly the kind of code that is normally C's and nobody else's.
Why Eskiu fit
- C libraries, directly. The pipeline leans on OpenSSL for
AES/RSA and
zxing-cppfor the QR reader. Eskiu speaks the C ABI natively, so it calls both through plainexterndeclarations, no wrapper layer. - Memory you account for. Every intermediate buffer is an
explicit
alloc<T>(n)/free. The whole allocation pattern is visible in the source, which matters when a single dropped free leaks a decrypted buffer. - A service without a framework. The decoder is wrapped in
an HTTP API (
POST /decode, multipart or JSON, with API-key auth and rate limiting) built entirely on Eskiu's standard library (<http>,<json>,<base64>, threading), with no external dependency. - Native, no runtime. It compiles straight to a small native binary through LLVM, so it drops onto a Linux host with only the two C libraries it links.
Bit-identical across the stack
The decoder exists in six implementations, kept in lockstep so a change to the algorithm is caught everywhere: pure C and Python, WebAssembly (in the browser), an Android AAR, an iOS XCFramework, and the Eskiu path. All six produce byte-for-byte identical output from the same credential. The Eskiu implementation is a full peer in that set, not a toy port, and its crypto pipeline runs 2.5× faster than the reference C it was measured against.
Dogfooding made the language better
Moving the decoder onto the current compiler was itself a test of the
language. The crypto code is dense with acquire-then-release patterns, so
defer / errdefer collapsed roughly fifteen manual
cleanup calls, and eight error-path cleanup cascades, into a single line each,
making a whole class of buffer leak impossible (verified leak-free under
AddressSanitizer). A --safe build adds bounds checks for parsing
untrusted images.
More telling: exercising real code surfaced two concrete improvements that
shipped straight back into the compiler in v0.6.1. Slicing a
raw heap pointer (ptr[lo..hi]) had crashed code generation; it now
builds a proper slice, so heap buffers, not just fixed arrays, can be sliced.
And a \xNN hex escape was added to string and character literals
for byte-precise data. The decoder needed both; the language grew to meet it.
So the same language that boots a bare-metal ARM64 kernel, and drops a memory-tight module into a C++ rendering engine (see the ReactVision case study), also decodes a real cryptographic format at native speed and serves it over HTTP. One language across the stack, used where it pays.
eskiu