Speck
- class urca.cpu.blocks.speck.Speck(text_size: int = 32, key_size: int = 64, alpha: int = 7, beta: int = 2)
Bases:
Block
The Speck block cipher.
- Parameters:
text_size (int, optional, default = 32) – the bit size of the block
key_size (int, optional, default = 64) – the bit size of the key
alpha (int, optional, default = 7) – the first rotation parameter
beta (int, optional, default = 2) – the second rotation parameter
- 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
- decrypt_function(texts: ndarray, keys: ndarray) None
Decrypt one round in-place.
- Parameters:
texts (np.ndarray) – ciphertexts
keys (np.ndarray) – keys
- 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
- encrypt_function(texts: ndarray, keys: ndarray) None
Encrypt one round in-place.
- Parameters:
texts (np.ndarray) – plaintexts
keys (np.ndarray) – keys
- 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