Simeck

class urca.cpu.blocks.simeck.Simeck(text_size: int = 32, key_size: int = 64, rot: tuple = (5, 1), z_sequence: int = 5557826286501673759)

Bases: Block

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

  • 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(texts: ndarray, keys: ndarray, state_index: int, n_rounds: int) None

Decrypt 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 using Simeck.

Parameters:
  • texts (np.ndarray) – plaintexts

  • keys (np.ndarray) – keys

  • state_index (int) – index of the current state

  • n_rounds (int) – number of encryption rounds

feistel(texts: ndarray, keys: ndarray) None

Apply the Simeck Feistel function to texts.

Parameters:
  • texts (np.ndarray) – plaintexts or texts

  • keys (np.ndarray) – keys