[PlaidCTF 2018] transducipher
At first, let’s define final_state(), which returns the last state of transduce(B, s) for input B. def transduce(b, s=0): if len(b) == 0: return b d, t = T[s] b0, bp = b[0], b[1:] return [b0 ^ t] + transduce(bp, s=d[b0]) def final_state(b, s=0): if len(b) == 0: return s d, _ = T[s] b0, bp = b[0], b[1:] return transduce_state(bp, s=d[b0]) The problem of breaking the cipher is that there’s swapping action of left 32 bits & right 32 bits in each stage....