
Tiny Crypto Core is a lightweight 64-bit symmetric encryption/decryption demo core designed for Tiny Tapeout. The design uses an 8-bit serial input/output interface to fit within the Tiny Tapeout 1x1 tile constraints.
The design stores a 64-bit data block and a 32-bit key internally. Since Tiny Tapeout provides 8-bit dedicated inputs and 8-bit dedicated outputs, both the plaintext/ciphertext and the key are loaded byte by byte.
The control pins are provided through uio_in:
uio_in[2:0]: byte addressuio_in[3]: load data byteuio_in[4]: load key byteuio_in[5]: start operationuio_in[6]: mode select, 0 for encryption and 1 for decryptionuio_in[7]: output select, 0 for status and 1 for data readThe data byte to be loaded is provided on ui_in[7:0].
When the start signal is asserted, the module generates a 64-bit keystream from the 32-bit key. The keystream is mixed for 16 clock cycles using rotation, addition, XOR, and round constants. At the end of the operation, the stored 64-bit data block is XORed with the final keystream.
Encryption and decryption use the same operation:
ciphertext = plaintext XOR keystream
plaintext = ciphertext XOR keystream
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | data_in[0] | busy / data_out[0] | addr[0] |
| 1 | data_in[1] | done / data_out[1] | addr[1] |
| 2 | data_in[2] | data_out[2] | addr[2] |
| 3 | data_in[3] | data_out[3] | load_data |
| 4 | data_in[4] | data_out[4] | load_key |
| 5 | data_in[5] | data_out[5] | start |
| 6 | data_in[6] | data_out[6] | mode |
| 7 | data_in[7] | data_out[7] | read_select |