CTF-CRYPTO-RSA-Repeat

CTF-CRYPTO-RSA-RepeatRSA-Repeat题目分析开始1.题目2.分析3.coppersmith's attack(1)urandom(2)next_prime(3)coppersmith's attack(4)得到p4.全脚本5.get flag结语每天一题,只能多不能少RSA-Repeat题目分析Coppersmith’s Attacknext_prime生成素数urandom生成伪随机数开始1.题目给出加密脚本#!/usr/bin/env python#
摘要由CSDN通过智能技术生成


每天一题,只能多不能少

RSA-Repeat

题目分析

  1. Coppersmith’s Attack
  2. next_prime生成素数
  3. urandom生成伪随机数

开始

1.题目

给出加密脚本

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Crypto.Util.number import *
import gmpy2
import os
from secret import flag

p = gmpy2.next_prime(bytes_to_long(os.urandom(32)*10))
q = getPrime(2048)
n = p * q
m = bytes_to_long(flag)
e = 65537
c = pow(m, e, n)
print 'n = ' + str(n)
print 'c = ' + str(c)

# n = 572380323110543806762187931273128722193435709756926816642052004003802906576115255381049400538789050623339958414724653807700220849963943780391024581734295237245817136575248005575384437530561047439528282274294310290432074136381265270526168274733661727933264495190518170593770545468258549234561928227154985019126684179911535520122548189466546900624307898883818104947698552309518321108330688889833085571684341142449313224437800650844459432954392952132787871731454325939784239114144523807329518306420403887735805334616090424676674405803526070090618626299141834402803692707689822477551331399213521572885973300391832870736199929562867932498794154410851696644020036901720703170201029212510016682689415957776177444510077721141586229397759973690453529991406553420298006282496576541088873832055250457639037534870299364639454189582762989184249613967070326224571006295213860385792681229392763968576369627625811184870717
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值