URCA documentation¶
Pages for the Unified Resource for Cryptographic Arrays project.
(Official logo.)¶
Motivation¶
Modern cryptographic research and experimentation increasingly require the generation and processing of large volumes of data. In this context, an efficient Python implementation for the batch encryption and decryption of cipher blocks can be particularly valuable, both for experimental evaluation and for the development and validation of cryptographic algorithms.
The URCA project is intended to provide a unified framework for these tasks. Its primary objective is to offer efficient implementations capable of processing batches of blocks while preserving the reference configurations of the considered ciphers. At the same time, whenever this is technically feasible, the implementations are designed to be as general as possible, allowing variations in parameters such as block size, key size, and other cipher-specific configurations without requiring substantial modifications to the underlying implementation.
First and last rounds¶
One of the most common scheme for a simmetric cipher is to have a number of rounds repeating the same structure. This is the most important skeleton of the cipher.
However, it is frequent to have some changes in the first round and/or in the last one. When this occurs in some design, it is important to say what is and what is not a round. Think about Speck [BSS+15], Present [BKL+07] and AES [DR99].
They represent three different cases.
Speck is word oriented and has not corner cases. Its implementation is suitable for any word size, unless constraints on parameters are met.
Present is a bit oriented cipher. Note that there is a final XOR with the key, meaning that the last round is different from the other ones.
AES has a declared different last round. It lacks of the mixcolumn operation.
Numbering rounds¶
Numbering rounds is another task that should be accomplished carefully and consistently.
The standard for this project is to use 0 as index for the plaintext and the master-key and considering both the state index and the number of rounds for encryption/decryption, so that the final state index will be the sum of state index and the number of rounds.
| ---- (state = registers) ------------------------------------ |
| ---- text[0] (plaintext) ---- | ---- key[0] (master-key) ---- |
| |
| (schedule) |
| |
V |
| ---- text[1] ---------------- | ---- key[0] ----------------- | | round
| |
| (key-schedule) |
| |
V V
| ---- text[1] ---------------- | ---- key[1] ----------------- |
Note that the schedule and the key-schedule can be swapped or mixed, if needed.
In this way, it is not needed an indexing for the rounds and the distance from plaintext and other inputs beside it to the evolved ones is always known, since the state index will be the number of rounds too. Not only, the number of rounds between two states will be the difference of the state indices.