RSA不同于模数攻击的破解法
来源:互联网 发布:高校财经数据库 编辑:程序博客网 时间:2024/05/29 03:39
题目:Alice decides to use RSA with the public key N = 1889570071. In order to guard against transmission errors, Alice has Bob encrypt his message twice, once using the encryption exponent e1 = 1021763679 and once using the encryption exponent e2 = 519424709. Eve intercepts the two encrypted messagesc1 = 1244183534 and c2 = 732959706. Assuming that Eve also knows N and the two encryption exponents e1 and e2. Please help Eve recover Bob’s plaintext without finding a factorization of N.
推导过程
原题中有两个公钥e1,e2都可以用私钥d解密则可以根据v扩战的欧基里德定理e1,e2互素,则可以使得 e1*s1+e2*s2=1;c1=m^e1 c2=m^e2[m^(e1*s1)]*[m^(e2*s2)]=m^(e1*s1+e2*s2)=m^1=m而 m^(e1*s1)=c1^s1 m^(e2*s2)=c2^s1根据推导则可以直接求出s1, s2进一步 [c1^s1]*[c2^s1]=m可以求出明文m
代码实现
#include <iostream>#include "Bignum.h"using namespace std;bignum ex_gcd(bignum a,bignum b,bignum &x,bignum &y){ bignum xi_1,yi_1,xi_2,yi_2; xi_2=1,yi_2=0; xi_1=0,yi_1=1; x=0,y=1; bignum r=a%b; bignum q=a/b; while (r==1) { x=xi_2-q*xi_1; y=yi_2-q*yi_1; xi_2=xi_1; yi_2=yi_1; xi_1=x,yi_1=y; a=b; b=r; r=a%b; q=a/b; } return b;}bignum PowerMod(bignum a, bignum b, bignum c){ bignum ans ; ans=1; a = a % c; while(b>0) { if(b%2==1) ans = (ans * a) % c; b = b/2; a = (a * a) % c; } return ans;}int main(){ bignum e1,e2,s1,s2,c1,c2,m,n; cin >> e1>>e2>>c1>>c2>>n; ex_gcd(e1,e2,s1,s2); m=PowerMod(c1,s1,n)*PowerMod(c2,s2,n); cout << m; return 0;}
输入输出:
input:1021763679 519424709 1244183534 732959706 1889570071output:732959706
阅读全文
0 0
- RSA不同于模数攻击的破解法
- 破解RSA的一些技术
- POJ 2447 RSA —— RSA加密算法的破解过程
- RSA加密算法及特定条件下的破解
- RSA指数模数加密
- RSA攻击之wiener攻击
- RSA 常见攻击方法
- RSA被山东大学破解!!?
- RSA加密与破解
- RSA加密与破解
- rsa破解简单练习
- RSA破解作业
- 电信级的RSA加密后密码的破解方法
- RSA 不用私钥破解原文的办法!
- 一种基于穷举碰撞的RSA降维破解算法
- 量子计算的能够破解RSA加密吗?
- 细数黑客攻击的七大战术
- 细数黑客攻击的七大战术
- 深入理解机器学习:从理论到算法-习题全解之第二十章:神经元网络
- leetcode: 19. Remove Nth Node From End of List
- Javaweb-xml编程-考生成绩管理系统(2)
- STM32 gcc编译环境搭建
- vsftpd服务
- RSA不同于模数攻击的破解法
- Python 练习实例1
- 2017年11月07日WEB随笔
- Linux centos7下MySQL的安装
- 网络编程—socket编程
- 文本配置无需编程的网页爬取框架Spider123
- android移植osgearth+依赖库
- 九九乘法表
- leetcode: 20. Valid Parentheses