赞
踩
公钥解析,得到e、n以及得到c1、c2、c3,分别打印三个m即可,最后找出属于flag的部分:
- from Crypto.PublicKey import RSA
- from Crypto.Util.number import *
- import gmpy2
-
- publickey = RSA.importKey(open(r'C:\Users\lenovo\Desktop\public.key','rb').read())
- e = publickey.e
- n = publickey.n
- p = 302825536744096741518546212761194311477
- q = 325045504186436346209877301320131277983
- c1 = bytes_to_long(open(r'C:\Users\lenovo\Desktop\encrypted.message1','rb').read())
- c2 = bytes_to_long(open(r'C:\Users\lenovo\Desktop\encrypted.message2','rb').read())
- c3 = bytes_to_long(open(r'C:\Users\lenovo\Desktop\encrypted.message3','rb').read())
-
- d = gmpy2.invert(e,(p-1)*(q-1))
- m1 = pow(c1,d,n)
- m2 = pow(c2,d,n)
- m3 = pow(c3,d,n)
- print(long_to_bytes(m1))
- print(long_to_bytes(m2))
- print(long_to_bytes(m3))
- #flag{3b6d3806-4b2b-11e7-95a0-000c29d7e93d}
看着冒号后面的,看起来就是把a移到了最后,应该是凯撒,得到:
gkbfnxeripjmxhemoc:abcdefghijklmnopqrstuvwxyz,看了wp才知道是playfair,冒号后面的就是key,但这里的key中i、j都有,26位,所以这里不需要用i代替j了,解出flag:
flagisctfshowicome
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。