CTF-CRYPTO-RSA-Repeat
每天一题,只能多不能少
RSA-Repeat
题目分析
- Coppersmith’s Attack
- next_prime生成素数
- 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