ctfshow_rsa刷题记录

ctfshow-rsa刷题记录

  • 1.easyrsa7
  • 2.easyrsa8
  • 3.funnyrsa2
  • 4.unusualrsa1

1.easyrsa7

已知信息:e , n , c , p的高位。
在这里插入图片描述
需要恢复p才行,要用到工具sagemath进行p恢复。

ctfshow_rsa刷题记录_第1张图片
后面就常规解题了已知p,n,e,c。求m。

2.easyrsa8

有两个文件一个密文,一个key文件。可以在线网站分解n,e。
在线公私钥分解
也可以代码解析。
ctfshow_rsa刷题记录_第2张图片
得到n用网站分解n得到p ,q。
n,e,p,q有了d也出来了后面就简单了。
代码:
ctfshow_rsa刷题记录_第3张图片

3.funnyrsa2

ctfshow_rsa刷题记录_第4张图片
解题代码:
ctfshow_rsa刷题记录_第5张图片

4.unusualrsa1

打开文件:
ctfshow_rsa刷题记录_第6张图片
明文高位已知用sage脚本跑出x
ctfshow_rsa刷题记录_第7张图片
m = ((m>>315)<<315) +x
代码:

from Crypto.Util.number import long_to_bytes
m2 = 61514818447540079794645696540635377371238400473636364474100415817811801375393480494308563648125 #315
m1= 1520800285708753284739523608878585974609134243280728660335545667177630830064371336150456537012842986526527904043383436211487979254140749228004148347597566264500276581990635110200009305900689510908049771218073767918907869112593870878204145615928290375086195098919355531430003571366638390993296583488184959318678321571278510231561645872308920917404996519309473979203661442792048291421574603018835698487725981963573816645574675640357569465990665689618997534740389987351864738104038598104713275375385003471306823348792559733332094774873827383320058176803218213042061965933143968710199376164960850951030741280074168795136
m =  m1+m2
print(long_to_bytes(m))

你可能感兴趣的:(ctf_rsa刷题记录,RSA)