[Crypto] Streamgame2 - CirQ xp0int Posted on Mar 27 2018 ? crypto ? ? Burteforce ? 直接爆破 ```python # from flag import flag # assert flag.startswith("flag{") # assert flag.endswith("}") # assert len(flag) == 27 def lfsr(R, mask): output = (R << 1) & 0xffffff i = R & mask & 0xffffff lastbit = 0 while i != 0: lastbit ^= (i & 1) i = i >> 1 output ^= lastbit return (output, lastbit) # R = int(flag[5:-1], 2) mask = 0x100002 def encrypt(R): ret = '' for i in range(12): tmp = 0 for j in range(8): (R, out) = lfsr(R, mask) tmp = (tmp << 1) ^ out ret += chr(tmp) return ret def brute_force(): with open('key', 'rb') as r: cipher = r.read() for i in range(2**20, 2**21): print i if encrypt(i) == cipher: raw_input() ``` **flag{110111100101001101001}** 打赏还是打残,这是个问题 赏 Wechat Pay Alipay [Reverse] babyre - sherlly [Misc]ai-nimals-MF
没有帐号? 立即注册