wechall Training: Crypto - Caesar II (Crypto, Training)

Crypto - Caesar II

I guess you are done with Caesar I, aren't you?
The big problem with caesar is that it does not allow digits or other characters.
I have fixed this, and now I can use any ascii character in the plaintext.
The keyspace has increased from 26 to 128 too. \o/

Enjoy!

45 6D 6D 62 20 68 6D 60 2A 20 77 6D 73 20 71 6D
6A 74 63 62 20 6D 6C 63 20 6B 6D 70 63 20 61 66
5F 6A 6A 63 6C 65 63 20 67 6C 20 77 6D 73 70 20
68 6D 73 70 6C 63 77 2C 20 52 66 67 71 20 6D 6C
63 20 75 5F 71 20 64 5F 67 70 6A 77 20 63 5F 71
77 20 72 6D 20 61 70 5F 61 69 2C 20 55 5F 71 6C
25 72 20 67 72 3D 20 2F 30 36 20 69 63 77 71 20
67 71 20 5F 20 6F 73 67 72 63 20 71 6B 5F 6A 6A
20 69 63 77 71 6E 5F 61 63 2A 20 71 6D 20 67 72
20 71 66 6D 73 6A 62 6C 25 72 20 66 5F 74 63 20
72 5F 69 63 6C 20 77 6D 73 20 72 6D 6D 20 6A 6D
6C 65 20 72 6D 20 62 63 61 70 77 6E 72 20 72 66
67 71 20 6B 63 71 71 5F 65 63 2C 20 55 63 6A 6A
20 62 6D 6C 63 2A 20 77 6D 73 70 20 71 6D 6A 73
72 67 6D 6C 20 67 71 20 66 63 6C 71 6A 70 62 62
63 6E 66 65 2C 

解题思路:

python实现16进制转换为10进制,再从0-127循环移位,之后转换为字符进行拼接

#16进制--->10进制--->ASCII码--->从0-127循环移位

num = "31 59 59 4E 20 54 59 4C 16 20 63 59 5F 20 5D 59 56 60 4F 4E 20 59 58 4F 20 57 59 5C 4F 20 4D 52 4B 56 56 4F 58 51 4F 20 53 58 20 63 59 5F 5C 20 54 59 5F 5C 58 4F 63 18 20 3E 52 53 5D 20 59 58 4F 20 61 4B 5D 20 50 4B 53 5C 56 63 20 4F 4B 5D 63 20 5E 59 20 4D 5C 4B 4D 55 18 20 41 4B 5D 58 11 5E 20 53 5E 29 20 1B 1C 22 20 55 4F 63 5D 20 53 5D 20 4B 20 5B 5F 53 5E 4F 20 5D 57 4B 56 56 20 55 4F 63 5D 5A 4B 4D 4F 16 20 5D 59 20 53 5E 20 5D 52 59 5F 56 4E 58 11 5E 20 52 4B 60 4F 20 5E 4B 55 4F 58 20 63 59 5F 20 5E 59 59 20 56 59 58 51 20 5E 59 20 4E 4F 4D 5C 63 5A 5E 20 5E 52 53 5D 20 57 4F 5D 5D 4B 51 4F 18 20 41 4F 56 56 20 4E 59 58 4F 16 20 63 59 5F 5C 20 5D 59 56 5F 5E 53 59 58 20 53 5D 20 52 4F 58 5D 56 5C 4E 4E 4F 5A 52 51 18"
hnum = num.split(' ')    #密文以空格分隔,存在列表中

onum = []

for i in hnum:
    onum.append(int(i,16))     #密文转换成10进制数

for i in range(128):     #循环移位
    a = []
    for j in onum:
        a.append(chr(j+i))   #转化为字符
    a1 = "".join(a)          #字符拼接为字符串
    print(a1)
    print("\n")

运行结果:

6换成空格即可

Good6job,6you6solved6one6more6challenge6in6your6journey.6This6one6was6fairly6easy6to6crack.6Wasn't6it?61286keys6is6a6quite6small6keyspace,6so6it6shouldn't6have6taken6you6too6long6to6decrypt6this6message.6Well6done,6your6solution6is6henslrddephg.

Good job, you solved one more challenge in your journey. This one was fairly easy to crack. Wasn't it? 128 keys is a quite small keyspace, so it shouldn't have taken you too long to decrypt this message. Well done, your solution is henslrddephg.

 

你可能感兴趣的:(wechall)