SPECK is a lightweight block cipher. It’s an ARX cipher, making it easy to implement in constant-time code.

Encryption round

Here’s one round of encryption with SPECK.

fn ernd(x: u64, y: u64, k: u64) -> (u64, u64) {
  let mut x = x;
  let mut y = y;
  x = x.rotate_right(8);
  x = x.wrapping_add(y);
  x ^= k;
  y = y.rotate_left(3);
  y ^= x;
  (x, y)
}

Key schedule