Skip to main content
Challenges SamFeistel-4: four-round cipher
Cryptography Expert Analyzing a low-round Feistel cipher: byte-lane structure and guess-and-determine attack Solves: 2

SamFeistel-4: four-round cipher

Author: CyberSamSU
Points
190

SamCard terminals seal data with the 'lightweight' block cipher SamFeistel-4. The design documentation is lost, but the source code remains and its full specification is below. You have a samfeistel_capture.json dump of the device: sbox (256 numbers, a permutation of 0..255), known_pairs (6 known plaintext / ciphertext pairs, hex), sealed_flag_ecb (flag, ECB, PKCS#7), and archive_ecb_old_key (an archive copy encrypted with an old key, cannot be decrypted with the current key).

Specification. Block size is 8 bytes: L0 = BE32(blok[0:4]), R0 = BE32(blok[4:8]). For a 32-bit word x, xj = (x >> 8j) & 0xFF (j = 0 is the least significant byte). SB(y) applies sbox to each byte of y. F(x, k) = ROTL32(SB(x ^ k), 8). Four rounds, each with an independent 32-bit key k0..k3 (128 bits total): (L, R) → (R, L ^ F(R, ki)). After the final round, the halves are not swapped: the ciphertext is BE32(L4) || BE32(R4).

Task: recover the keys and decrypt sealed_flag_ecb. Flag format: BAYROQ{FEISTEL_QISQA_xxxxxxxxxxxxxxxx} (last 16 characters lowercase hex). A 128-bit key cannot be brute-forced directly; the computational cost of a smart attack is around 220.

Attached files
samfeistel_capture.json Log in to download
Hints 3
Opening a hint reduces the points you get for solving this challenge.
Hint 1 −19 pts Log in
Hint 2 −38 pts Log in
Hint 3 −57 pts Log in
To submit a flag, log in.

First solvers

1. Odam 25.11.2026
2. Mirjaxon Qaxxarov 25.11.2026