Present
- class urca.cpu.blocks.present.Present(text_size: int = 64, key_size: int = 80, sbox: tuple[int] = (12, 5, 6, 11, 9, 0, 10, 13, 3, 14, 15, 8, 4, 7, 1, 2))
Bases:
Block
The Present block cipher.
- Parameters:
text_size (int, optional, default = 64) – the bit size of the block
key_size (int, optional, default = 80) – the bit size of the key
sbox (tuple[int], optional, default =
urca.constants.PRESENT_SBOX
) – the s-box for the cipher
- decrypt(texts: ndarray, keys: ndarray, state_index: int, n_rounds: int) None
Dencrypt in-place.
- Parameters:
texts (np.ndarray) – ciphertexts
keys (np.ndarray) – keys
state_index (int) – index of the current state
n_rounds (int) – number of decryption rounds
- encrypt(texts: ndarray, keys: ndarray, state_index: int, n_rounds: int) None
Encrypt in-place.
- Parameters:
texts (np.ndarray) – plaintexts
keys (np.ndarray) – keys
state_index (int) – index of the current state
n_rounds (int) – number of encryption rounds
- revert_keys(keys: ndarray, round_number: int) None
Revert the keys in-place.
- Parameters:
keys (np.ndarray) – keys
round_number (int) – current round
- update_keys(keys: ndarray, round_number: int) None
Update the keys in-place.
- Parameters:
keys (np.ndarray) – keys
round_number (int) – current round