Speck¶
- class urca.cpu.blockciphers.speck.Speck(block_size: int = 32, key_size: int = 64, alpha: int = 7, beta: int = 2)¶
Bases:
BlockCipherThe Speck block cipher.
- Parameters:
block_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(blocks: ndarray, keys: ndarray, state_index: int, n_rounds: int) None¶
Dencrypt in-place.
- Parameters:
blocks (np.ndarray) – blocks
keys (np.ndarray) – keys
state_index (int) – index of the current state
n_rounds (int) – number of decryption rounds
- decrypt_function(blocks: ndarray, keys: ndarray) None¶
Decrypt one round in-place.
- Parameters:
blocks (np.ndarray) – blocks
keys (np.ndarray) – keys
- encrypt(blocks: ndarray, keys: ndarray, state_index: int, n_rounds: int) None¶
Encrypt in-place.
- Parameters:
blocks (np.ndarray) – blocks
keys (np.ndarray) – keys
state_index (int) – index of the current state
n_rounds (int) – number of encryption rounds
- encrypt_function(blocks: ndarray, keys: ndarray) None¶
Encrypt one round in-place.
- Parameters:
blocks (np.ndarray) – blocks
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