A hardware implementation of the ChaCha20 stream cipher (RFC 8439), built for Tiny Tapeout on the GF180MCU process.
ChaCha20 is a modern stream cipher (Daniel J. Bernstein's refinement of Salsa20), standardized in RFC 8439 and widely used in TLS, SSH, and WireGuard. It is an Add-Rotate-XOR (ARX) design: no S-boxes or lookup tables, just additions, bit rotations, and XORs, which makes it compact and fast in hardware. From a 256-bit key, a 96-bit nonce, and a 32-bit block counter it produces a pseudorandom keystream. You encrypt by XORing data with that keystream, and because XOR is self-inverse, decryption is the exact same operation.
The chip runs the ChaCha20 block function on-chip and exposes two operations:
- GEN: stream out the raw keystream.
- CRYPT: XOR a stream of data with the keystream (encrypt, or decrypt by feeding the ciphertext back in with the same key, nonce, and counter).
You load the key, nonce, and counter and issue commands from a host over either an 8N1 UART or a faster synchronous parallel byte bus, chosen at runtime by the MODE pin.
See the docs for the command protocol, pin map, and examples.
| PDK | Shuttle | Tiles | Clock |
|---|---|---|---|
| gf180mcuD (GF180MCU) | TTGF26b | 3x4 | 35 MHz |
The Verilog sources are in src/ (a ChaCha20 block engine, a command FSM, and the UART and parallel front-ends); the documentation is in docs/; and the cocotb testbenches are in test/. To run the test suite (Icarus Verilog and cocotb, both from the OSS CAD Suite):
cd test
./run_unit_tests.sh