当前位置:网站首页>BUUCTF-[BJDCTF2020]RSA1
BUUCTF-[BJDCTF2020]RSA1
2022-07-27 21:07:00 【[email protected]】
1.题目代码:
# from Crypto.Util.number import getPrime,bytes_to_long
#
# flag=open("flag","rb").read()
#
# p=getPrime(1024)
# q=getPrime(1024)
# assert(e<100000)
# n=p*q
# m=bytes_to_long(flag)
# c=pow(m,e,n)
# print c,n
# print pow(294,e,n)
#
# p=getPrime(1024)
# n=p*q
# m=bytes_to_long("BJD"*32)
# c=pow(m,e,n)
# print c,n
#
# '''
# output:
# 12641635617803746150332232646354596292707861480200207537199141183624438303757120570096741248020236666965755798009656547738616399025300123043766255518596149348930444599820675230046423373053051631932557230849083426859490183732303751744004874183062594856870318614289991675980063548316499486908923209627563871554875612702079100567018698992935818206109087568166097392314105717555482926141030505639571708876213167112187962584484065321545727594135175369233925922507794999607323536976824183162923385005669930403448853465141405846835919842908469787547341752365471892495204307644586161393228776042015534147913888338316244169120
# 13508774104460209743306714034546704137247627344981133461801953479736017021401725818808462898375994767375627749494839671944543822403059978073813122441407612530658168942987820256786583006947001711749230193542370570950705530167921702835627122401475251039000775017381633900222474727396823708695063136246115652622259769634591309421761269548260984426148824641285010730983215377509255011298737827621611158032976420011662547854515610597955628898073569684158225678333474543920326532893446849808112837476684390030976472053905069855522297850688026960701186543428139843783907624317274796926248829543413464754127208843070331063037
# 381631268825806469518166370387352035475775677163615730759454343913563615970881967332407709901235637718936184198930226303761876517101208677107311006065728014220477966000620964056616058676999878976943319063836649085085377577273214792371548775204594097887078898598463892440141577974544939268247818937936607013100808169758675042264568547764031628431414727922168580998494695800403043312406643527637667466318473669542326169218665366423043579003388486634167642663495896607282155808331902351188500197960905672207046579647052764579411814305689137519860880916467272056778641442758940135016400808740387144508156358067955215018
# 979153370552535153498477459720877329811204688208387543826122582132404214848454954722487086658061408795223805022202997613522014736983452121073860054851302343517756732701026667062765906277626879215457936330799698812755973057557620930172778859116538571207100424990838508255127616637334499680058645411786925302368790414768248611809358160197554369255458675450109457987698749584630551177577492043403656419968285163536823819817573531356497236154342689914525321673807925458651854768512396355389740863270148775362744448115581639629326362342160548500035000156097215446881251055505465713854173913142040976382500435185442521721
# 12806210903061368369054309575159360374022344774547459345216907128193957592938071815865954073287532545947370671838372144806539753829484356064919357285623305209600680570975224639214396805124350862772159272362778768036844634760917612708721787320159318432456050806227784435091161119982613987303255995543165395426658059462110056431392517548717447898084915167661172362984251201688639469652283452307712821398857016487590794996544468826705600332208535201443322267298747117528882985955375246424812616478327182399461709978893464093245135530135430007842223389360212803439850867615121148050034887767584693608776323252233254261047
# '''2.复现
首先用n1和n2求出公因数q,然后再爆破e。
import gmpy2
import libnum
c1=12641635617803746150332232646354596292707861480200207537199141183624438303757120570096741248020236666965755798009656547738616399025300123043766255518596149348930444599820675230046423373053051631932557230849083426859490183732303751744004874183062594856870318614289991675980063548316499486908923209627563871554875612702079100567018698992935818206109087568166097392314105717555482926141030505639571708876213167112187962584484065321545727594135175369233925922507794999607323536976824183162923385005669930403448853465141405846835919842908469787547341752365471892495204307644586161393228776042015534147913888338316244169120
n1=13508774104460209743306714034546704137247627344981133461801953479736017021401725818808462898375994767375627749494839671944543822403059978073813122441407612530658168942987820256786583006947001711749230193542370570950705530167921702835627122401475251039000775017381633900222474727396823708695063136246115652622259769634591309421761269548260984426148824641285010730983215377509255011298737827621611158032976420011662547854515610597955628898073569684158225678333474543920326532893446849808112837476684390030976472053905069855522297850688026960701186543428139843783907624317274796926248829543413464754127208843070331063037
c2=979153370552535153498477459720877329811204688208387543826122582132404214848454954722487086658061408795223805022202997613522014736983452121073860054851302343517756732701026667062765906277626879215457936330799698812755973057557620930172778859116538571207100424990838508255127616637334499680058645411786925302368790414768248611809358160197554369255458675450109457987698749584630551177577492043403656419968285163536823819817573531356497236154342689914525321673807925458651854768512396355389740863270148775362744448115581639629326362342160548500035000156097215446881251055505465713854173913142040976382500435185442521721
n2=12806210903061368369054309575159360374022344774547459345216907128193957592938071815865954073287532545947370671838372144806539753829484356064919357285623305209600680570975224639214396805124350862772159272362778768036844634760917612708721787320159318432456050806227784435091161119982613987303255995543165395426658059462110056431392517548717447898084915167661172362984251201688639469652283452307712821398857016487590794996544468826705600332208535201443322267298747117528882985955375246424812616478327182399461709978893464093245135530135430007842223389360212803439850867615121148050034887767584693608776323252233254261047
q=gmpy2.gcd(n1,n2)
p=n1//q
#pow(294,e,n)
x=381631268825806469518166370387352035475775677163615730759454343913563615970881967332407709901235637718936184198930226303761876517101208677107311006065728014220477966000620964056616058676999878976943319063836649085085377577273214792371548775204594097887078898598463892440141577974544939268247818937936607013100808169758675042264568547764031628431414727922168580998494695800403043312406643527637667466318473669542326169218665366423043579003388486634167642663495896607282155808331902351188500197960905672207046579647052764579411814305689137519860880916467272056778641442758940135016400808740387144508156358067955215018
e=0
for i in range(100000):
if(pow(294,i,n1)==x):
e=i#52361
print(e)
phi=(p-1)*(q-1)
d=gmpy2.invert(e,phi)
m=pow(c1,d,n1)
print(libnum.n2s(int(m)))
# 52361
# b'BJD{p_is_common_divisor}'版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_61774705/article/details/124696288
边栏推荐
- Which one is better to request to merge -- three skills of interface request merging, and the performance directly explodes the table
- Is it really hard to understand? What level of cache is the recyclerview caching mechanism?
- Comparison between virtual memory and cache
- The total investment is 60billion! Foxconn semiconductor high-end package test project officially settled in Qingdao
- Key points of data management
- Interviewer: let's talk about the specific process of network data transmission
- 苹果发布新款iPhone SE:搭载A13仿生处理器,售价3299元起
- Yijia will release ODM orders in 2020 and make efforts in the middle and low-end market
- 2019年全球十大半导体厂商:英特尔重回第一,苹果逆势大涨
- Ideas, methods and steps of making folding fans with 3DMAX
猜你喜欢

Ideas, methods and steps of making folding fans with 3DMAX

Redefine analysis - release of eventbridge real-time event analysis platform

MapReduce(三)

proteus仿真arduino中调用DHT11/22温湿度传感器

Realization of gobang man-machine combat

Nature review: preferential effects in the formation of microbial communities

org.junit.runners.model.InvalidTestClassError: Invalid test class ‘com.zhj.esdemo.MysqlTests‘: 1.

详解分布式系统的幂等

【JS 逆向百例】某公共资源交易网,公告 URL 参数逆向分析
![[December Haikou] the 6th International Conference on ships, marine and Maritime Engineering in 2022 (naome 2022)](/img/a4/041268aadd5d8ff493b52ead9c5e79.png)
[December Haikou] the 6th International Conference on ships, marine and Maritime Engineering in 2022 (naome 2022)
随机推荐
编辑复制粘贴判定问题(bug?),所见即所得显示符号问题反馈。
2022/7/26
Apple releases new iPhone se: equipped with A13 bionic processor, priced from 3299 yuan
Can Siemens PLC collect analog data of multiple slave stations in real time and wirelessly?
加速IGBT国产化!比亚迪半导体将独立上市,市值或达300亿元!
远程调试 idea配置remote debug、在远程服务器的程序中,添加JVM启动参数-Xdebug
Application of user portrait in precise push of wechat official account of scientific journals
总投资600亿!富士康半导体高端封测项目正式落户青岛
TCP的粘包拆包问题+解决方案
Redis hash underlying data structure
基于原生js实现今日新闻网站
Common Taylor expansion
Interviewer: let's talk about the specific process of network data transmission
JUC toolkit learning
JS提升:JS中的数组扁平化问题
数据中台的那些“经验与陷阱”
29. Learn the stacked column chart of highcharts using percentage
新技术引领大中型企业营销新变革,用友BIP CRM重磅发布!
My annual salary is 1million, and I don't have clothes more than 100 yuan all over my body: saving money is the top self-discipline
CPU的控制方式