[随波逐流]CTF Flags

   [随波逐流]CTF Flags

软件版本:v1.0.0   数据版本: v20260201
返    回

XOR with fixed length key

 广告模块
ID: 2090
标题: XOR with fixed length key
描述: import os, random, hashlib from itertools import cycle pt = [i%230 for i in os.urandom(500000)] klen = random.randint(1000,10000) key = random.getrandbits(klen*8).to_bytes(klen, 'big') open('ct', 'wb').write(bytes(c^i for c,i in zip(pt, cycle(key)))) flag = "greyhats{%s}"%hashlib.sha256(key).hexdigest() print(flag) JuliaPoo Hint: Gotten the key length but there's too many possibilities? That's great! Now you can ignore the non-uniform distribution of the plaintext and focus entirely on exploiting python's random module. Mini technicality: Please assume that klen and key are generated independently. This is because the challenge file was generated 2 years ago and I can no longer guarantee that they are generated with the same random internal state given that I have the memory of a goldfish. Regardless, the intended solution doesn't require klen to be generated with the same random internal state.
类型: CTF-2023
网站: bugku
题目链接: https://ctf.bugku.com/challenges/detail/id/2237.html
赛事: Welcome
年度: None
Flag值:
writeup: https://achyutkoirala.com.np/writeups/base/cryptopals/set1/challenge2/
答案错误,我要更正