Simeck

class urca.cpu.blockciphers.simeck.Simeck(block_size: int = 32, key_size: int = 64, alpha: int = 5, beta: int = 1, z_sequence: int = 5557826286501673759)

Bases: BlockCipher

The Simeck 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

  • rot (tuple, optional, default = (5, 1)) – the rotation amounts in round schedule

  • z_sequence (int, optional, default = constants.SIMECK_Z0) – the bit sequence for key schedule

decrypt(blocks: ndarray, keys: ndarray, state_index: int, n_rounds: int) → None

Decrypt 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

encrypt(blocks: ndarray, keys: ndarray, state_index: int, n_rounds: int) → None

Encrypt using Simeck.

Parameters:
  • blocks (np.ndarray) – blocks

  • keys (np.ndarray) – keys

  • state_index (int) – index of the current state

  • n_rounds (int) – number of encryption rounds

feistel(blocks: ndarray, keys: ndarray) → None

Apply the Simeck Feistel function to blocks.

Parameters:
  • blocks (np.ndarray) – blocks

  • keys (np.ndarray) – keys