NSSCTF—团队题库—Crypto—Easy_Game
第一关是MD5爆破,满足字符串的长度为3,且MD5值得最后五位是‘70c3c’
脚本:
from hashlib import md5 flag='' for i in range(32,127): for j in range(32,127): for k in range(32,127): flag=chr(i)+chr(j)+chr(k) m=md5() m.update(flag.encode("utf-8")) res=m.hexdigest() if res[:5]=='70c3c': print(flag) break
得到答案:fve
第二关:
直接梭出来是base85(a)
得到答案:crypto is the best!!!
第三关:
一开始以为是RSA,但是仔细看看,RSA中m是明文,c是明文,不对不对
加密操作就是已知n
m是在2,n-1范围内的随机数,再加一
c是m的bytes_to_long(flag)再对n取模
脚本:
from Crypto.Util.number import * import sympy m = 105809247437229292896244724848774719893600473537571285288901615727789525100494994525037179227354192828840336481024280812022699936297715186106103808528496271783354948177286729386143770779180012768306315871153177830287978057972670236340157364563235125891781672541796625798661847373596187498412645897434882050923 c = 152301750569471329631722927389040635553341693993249919136632772002283239124383241562236515470293930840964750565890184815655317825406689580466157787940486615372578638957954958236508796652877884832587613706072178078693896127935002983261347341170886771485241679427369293850679494455280225284776670426487479783387 print(long_to_bytes(sympy.discrete_log(2 ** 1024, c, m)))
脚本里使用的函数sympy.discrete_log的意思是:
简单易懂
得到flag
NSSCTF{I am so sad that no one studies crypto!!!}