Cryptopals S1-3

题目地址:

https://cryptopals.com/sets/1/challenges/3

解法:

legal_chars = "01234567890abcdefghijklmnopgrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ"

x = bytes.fromhex("1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736")
for i in range(256):
    y = [chr(i^sx) for sx in x]
    if len([c for c in y if c in legal_chars]) > 0.7 * len(x):
        print(i, "".join(y))

 

感想:

还以为要把ETAOIN SHRDLU这句话当成答案

原文地址:https://www.cnblogs.com/xuesu/p/12000298.html