密码基础
1. Introduction to CryptoHack
入站的凯撒密码
比如说有个密码: YXKXKX OBRKFLK CXAB OXQB 凯撒密码是用的位移的原理。这个密码前移23位(或者后移3位)即可解密。比如说Y,在字母表里前移23位得到B,,所以总体解密得到: BANANA REUNION FADE RATE
scripts
这个要告诉我们的原则是解密常用写脚本的方式。运行即可。
#!/usr/bin/env python3
import sys
# import this
if sys.version_info.major == 2:
print("You are running Python 2, which is no longer supported. Please update to Python 3.")
ords = [81, 64, 75, 66, 70, 93, 73, 72, 1, 92, 109, 2, 84, 109, 66, 75, 70, 90, 2, 92, 79]
print("Here is your flag:")
print("".join(chr(o ^ 0x32) for o in ords))
得到结果:
Here is your flag:
crypto{z3n_0f_pyth0n}
ASCII
得到了一串ASCII码串,提示我们可以用chr()函数去写脚本。ASCII码就是数字对应的字符,可以对表。那么我们写一个简单的脚本运行:
# ASCII 码列表
ascii_codes = [99, 114, 121, 112, 116, 111, 123, 65, 83, 67, 73, 73, 95, 112, 114, 49, 110, 116, 52, 98, 108, 51, 125]
# 将 ASCII 码转换为字符并连接成字符串
decoded_string = ''.join(chr(code) for code in ascii_codes)
print(decoded_string)