码迷,mamicode.com
首页 > 其他好文 > 详细

Cryptopals S1-3

时间:2019-12-07 01:24:37      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:als   rdl   com   python   hex   ges   https   from   rom   

题目地址:

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这句话当成答案

Cryptopals S1-3

标签:als   rdl   com   python   hex   ges   https   from   rom   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!