当前位置:网站首页>BUUCTF-Baby RSA
BUUCTF-Baby RSA
2022-07-27 21:07:00 【[email protected]】
1.题目代码:
# p+q : 0x1232fecb92adead91613e7d9ae5e36fe6bb765317d6ed38ad890b4073539a6231a6620584cea5730b5af83a3e80cf30141282c97be4400e33307573af6b25e2ea
# (p+1)(q+1) : 0x5248becef1d925d45705a7302700d6a0ffe5877fddf9451a9c1181c4d82365806085fd86fbaab08b6fc66a967b2566d743c626547203b34ea3fdb1bc06dd3bb765fd8b919e3bd2cb15bc175c9498f9d9a0e216c2dde64d81255fa4c05a1ee619fc1fc505285a239e7bc655ec6605d9693078b800ee80931a7a0c84f33c851740
# e : 0xe6b1bee47bd63f615c7d0a43c529d219
# d : 0x2dde7fbaed477f6d62838d55b0d0964868cf6efb2c282a5f13e6008ce7317a24cb57aec49ef0d738919f47cdcd9677cd52ac2293ec5938aa198f962678b5cd0da344453f521a69b2ac03647cdd8339f4e38cec452d54e60698833d67f9315c02ddaa4c79ebaa902c605d7bda32ce970541b2d9a17d62b52df813b2fb0c5ab1a5
# enc_flag : 0x50ae00623211ba6089ddfae21e204ab616f6c9d294e913550af3d66e85d0c0693ed53ed55c46d8cca1d7c2ad44839030df26b70f22a8567171a759b76fe5f07b3c5a6ec89117ed0a36c0950956b9cde880c575737f779143f921d745ac3bb0e379c05d9a3cc6bf0bea8aa91e4d5e752c7eb46b2e023edbc07d24a7c460a34a9a
2.复现:
主要就是通过p+q和(p+1)*(q+1)来算n的值。
import libnum
pjiaq=0x1232fecb92adead91613e7d9ae5e36fe6bb765317d6ed38ad890b4073539a6231a6620584cea5730b5af83a3e80cf30141282c97be4400e33307573af6b25e2ea
pjia1xqjia1=0x5248becef1d925d45705a7302700d6a0ffe5877fddf9451a9c1181c4d82365806085fd86fbaab08b6fc66a967b2566d743c626547203b34ea3fdb1bc06dd3bb765fd8b919e3bd2cb15bc175c9498f9d9a0e216c2dde64d81255fa4c05a1ee619fc1fc505285a239e7bc655ec6605d9693078b800ee80931a7a0c84f33c851740
e = 0xe6b1bee47bd63f615c7d0a43c529d219
d =0x2dde7fbaed477f6d62838d55b0d0964868cf6efb2c282a5f13e6008ce7317a24cb57aec49ef0d738919f47cdcd9677cd52ac2293ec5938aa198f962678b5cd0da344453f521a69b2ac03647cdd8339f4e38cec452d54e60698833d67f9315c02ddaa4c79ebaa902c605d7bda32ce970541b2d9a17d62b52df813b2fb0c5ab1a5
c=0x50ae00623211ba6089ddfae21e204ab616f6c9d294e913550af3d66e85d0c0693ed53ed55c46d8cca1d7c2ad44839030df26b70f22a8567171a759b76fe5f07b3c5a6ec89117ed0a36c0950956b9cde880c575737f779143f921d745ac3bb0e379c05d9a3cc6bf0bea8aa91e4d5e752c7eb46b2e023edbc07d24a7c460a34a9a
# (p+1)(q+1)=pq+p+q+1
# (p-1)(q-1)=pq-p-q-1
# (p-1)(q-1)=(p+1)(q+1)-2(p+q)-2
#n=pq=((p+1)(q+1)+(p-1)(q-1))/2
phi=pjia1xqjia1-2*pjiaq-2
n=(phi+pjia1xqjia1)//2
m=pow(c,d,n)
print(libnum.n2s(int(m)))
# b'flag{cc7490e-78ab-11e9-b422-8ba97e5da1fd}'版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_61774705/article/details/124674479
边栏推荐
- Redis hash underlying data structure
- Date的使用
- C#委托用法--控制台项目,通过委托实现事件
- 数据管理的重点
- NDK series (6): let's talk about the way and time to register JNI functions
- Arm32 for remote debugging
- [number recognition] recognize 0-9 numbers based on Hopfield neural network with matlab code
- 尚硅谷尚品项目汇笔记(一)
- Xu Jinbo: AI protein prediction and design
- Introduction to several common usage scenarios of message queue
猜你喜欢

Huawei Hongmeng 3 was officially released, and this security feature has solved a major pain point

JUC工具包学习

The print version of imeta | international standard ISSN is officially confirmed, and the application for dual ISSN is completed

Remotely debug idea, configure remote debug, and add JVM startup parameter -xdebug in the program of remote server

字符流学习14.3

2022 International Conference on civil, building and Environmental Engineering (iccaee 2022)

File&递归14.1

基于原生js实现今日新闻网站

Ideas, methods and steps of making folding fans with 3DMAX
![[C language] address book (dynamic version)](/img/29/3df19c187bee31ee4671e12d7cc7ff.jpg)
[C language] address book (dynamic version)
随机推荐
并发和并行有什么区别?
Using the optical fingerprint scheme under the huiding screen, Samsung Galaxy a71 5g is listed
The print version of imeta | international standard ISSN is officially confirmed, and the application for dual ISSN is completed
29.学习Highcharts 使用百分比的堆叠柱形图
真的很难理解?RecyclerView 缓存机制到底是几级缓存?
Reinforcement learning - pytorch realizes advantage actor critical (A2C)
进制转换方法
MapReduce(三)
TCP的粘包拆包问题+解决方案
Current situation and future of Nb IOT industry: cross the threshold of 100million shipments and rush to 5g connection!
Join hands with Changjiang storage, jiangbolong launches the world's smallest expansion card
29. Learn the stacked column chart of highcharts using percentage
Those "experiences and traps" in the data center
In 2019, the world's top ten semiconductor manufacturers: Intel returned to the first place, and apple rose sharply against the trend
Spark 离线开发框架设计与实现
用3dmax做折扇的思路方法与步骤
NDK series (6): let's talk about the way and time to register JNI functions
【12月海口】2022年第六届船舶,海洋与海事工程国际会议(NAOME 2022)
字符流学习14.3
Shuffle, partition and read of tfrecord