前言
密码学之旅
正文
easy
一个简单的base64解密
keyboard
看看键盘,比划一下,发现是areuhack
异性相吸
TIPS:
1.xor //异或
2.hex2binary //十六进制转二进制
3.len(bin(miwen))==len(bin(mingwen)) //二进制密文长度等于二进制明文长度
这是所有的提示信息
脚本,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| ming=[] with open("ming.txt") as f1: for i in f1.read(): ming.append(i) print(ming)
mi=[] with open("mi.txt") as f2: for i in f2.read(): mi.append(i) print(mi)
flag='' for i in range(len(ming)): flag+=chr(ord(ming[i])^ord(mi[i])) print flag
|
Winner Winner Chicken Dinner
给了一个加密算法
1 2 3 4 5 6 7 8 9 10 11
| from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_v1_5 as Cipher_pkcs1_v1_5 import base64
flag=raw_input('flag:') key=RSA.construct((1063045321283844468344531168992778520651192162100948533991539097447031440090068191835838938460807260866872379834796862916118785271062209281267667069640000501698142693389209275376843382863579650119977059768375028586326490055087394631528241983631462471709913758728591459476799115050977493979613545056736162868049L, 837165022918376318972691589160491375229372195625940137121740685432530132860541010174727630660292946071507342455170833392895060048564125597915757582027572284342507277083636059558106672685400173531425920294781499112027917632497954958437660357575400222692979844873372105801998210845285775146263117399191185379347L)) cipher = Cipher_pkcs1_v1_5.new(key) cipher_text = base64.b64encode(cipher.encrypt(flag)) print cipher_text
|
这考察了RSA的winner’s attack,
参考文章