主题: [MATLAB基础] rsa加密解密数据过大
查看单个帖子
旧 2014-01-06, 00:12   #1
月球那半边
初级会员
 
注册日期: 2014-01-06
帖子: 1
声望力: 0
月球那半边 正向着好的方向发展
默认 rsa加密解密数据过大

实验要求做一个rsa加密解密的matlab程序,
p=3;
q=11;
e=7;
n=p*q;
a=(p-1)*(q-1);
for i=1:a+1 %计算d
b=mod(e*i,a);
if b==1
d=i;
disp(d)
else
i=i+1;
end
end
A=load('D:\1.txt');
B=power(A,e)
C=mod(B,n)
D=power(C,d)
E=mod(D,n)
disp('public key:')
disp([n,e])
disp('private key:')
disp([n,d])
disp('cipher text is :')
disp(C)
disp('deciphered text is :')
disp(E)
这是我自己写的,对于小数据能运行,但是大数据就出问题,应该怎么改啊请问。
message(1.txt)为5566 7788 123 98765 739 1111 19 705 1209 1116
p = 9973, q = 997, e =10243
加密后应该为526459 8464775 2559950 8368498 1743494 7767529 2889668 8913214 8050998 8129974
谢谢了
月球那半边 当前离线   回复时引用此帖