欢迎来到天天文库
浏览记录
ID:35941626
大小:204.50 KB
页数:30页
时间:2019-04-26
《rsa加解密算法c语言地实现》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、实用文案#include#include#include#include#include#include#defineMAX100#defineLENsizeof(structslink)voidsub(inta[MAX],intb[MAX],intc[MAX]);structslink{intbignum[MAX];/*bignum[98]用来标记正负号,1正,0负bignum[99]来标记实际长度*/structslink*n
2、ext;};/*/--------------------------------------自己建立的大数运算库-------------------------------------*/voidprint(inta[MAX]){inti;for(i=0;il2)return1;
3、if(l1=0;i--){if(a1[i]>a2[i])return1;if(a1[i]4、f(a1[MAX-2]=='-'&&a2[MAX-2]=='-')c[MAX-2]=0;elseif(a1[MAX-2]=='-')c[MAX-2]='-';elseif(a2[MAX-2]=='-')c[MAX-2]='-';for(i=0;i5、MAX-1]=w;return;}voidadd(inta1[MAX],inta2[MAX],int*c){inti,l1,l2;intlen,temp[MAX];intk=0;l1=a1[MAX-1];l2=a2[MAX-1];if((a1[MAX-2]=='-')&&(a2[MAX-2]=='-')){c[MAX-2]='-';}elseif(a1[MAX-2]=='-'){mov(a1,temp);temp[MAX-2]=0;sub(a2,temp,c);return;}elseif(a2[MAX-2]=='-'){mov(a2,t6、emp);temp[98]=0;sub(a1,temp,c);return;}if(l1len){for(i=len;i7、=(a2[i]+k)%10;k=(a2[i]+k)/10;}if(k!=0){c[l2]=k;len=l2+1;}elselen=l2;}c[99]=len;return;}voidsub(inta1[MAX],inta2[MAX],int*c){inti,l1,l2;intlen,t1[MAX],t2[MAX];intk=0;l1=a1[MAX-1];l2=a2[MAX-1];if((a1[MAX-2]=='-')&&(a2[MAX-2]=='-')){mov(a1,t1);mov(a2,t2);t1[MAX-2]=0;t2[MAX-28、]=0;sub(t2,t1,c);return;标准文档实用文案}elseif(a2[MAX-2]=='-'){mov(a2,t2);t2[MAX-2]=0;add(a1,t2,c);retu
4、f(a1[MAX-2]=='-'&&a2[MAX-2]=='-')c[MAX-2]=0;elseif(a1[MAX-2]=='-')c[MAX-2]='-';elseif(a2[MAX-2]=='-')c[MAX-2]='-';for(i=0;i5、MAX-1]=w;return;}voidadd(inta1[MAX],inta2[MAX],int*c){inti,l1,l2;intlen,temp[MAX];intk=0;l1=a1[MAX-1];l2=a2[MAX-1];if((a1[MAX-2]=='-')&&(a2[MAX-2]=='-')){c[MAX-2]='-';}elseif(a1[MAX-2]=='-'){mov(a1,temp);temp[MAX-2]=0;sub(a2,temp,c);return;}elseif(a2[MAX-2]=='-'){mov(a2,t6、emp);temp[98]=0;sub(a1,temp,c);return;}if(l1len){for(i=len;i7、=(a2[i]+k)%10;k=(a2[i]+k)/10;}if(k!=0){c[l2]=k;len=l2+1;}elselen=l2;}c[99]=len;return;}voidsub(inta1[MAX],inta2[MAX],int*c){inti,l1,l2;intlen,t1[MAX],t2[MAX];intk=0;l1=a1[MAX-1];l2=a2[MAX-1];if((a1[MAX-2]=='-')&&(a2[MAX-2]=='-')){mov(a1,t1);mov(a2,t2);t1[MAX-2]=0;t2[MAX-28、]=0;sub(t2,t1,c);return;标准文档实用文案}elseif(a2[MAX-2]=='-'){mov(a2,t2);t2[MAX-2]=0;add(a1,t2,c);retu
5、MAX-1]=w;return;}voidadd(inta1[MAX],inta2[MAX],int*c){inti,l1,l2;intlen,temp[MAX];intk=0;l1=a1[MAX-1];l2=a2[MAX-1];if((a1[MAX-2]=='-')&&(a2[MAX-2]=='-')){c[MAX-2]='-';}elseif(a1[MAX-2]=='-'){mov(a1,temp);temp[MAX-2]=0;sub(a2,temp,c);return;}elseif(a2[MAX-2]=='-'){mov(a2,t
6、emp);temp[98]=0;sub(a1,temp,c);return;}if(l1len){for(i=len;i7、=(a2[i]+k)%10;k=(a2[i]+k)/10;}if(k!=0){c[l2]=k;len=l2+1;}elselen=l2;}c[99]=len;return;}voidsub(inta1[MAX],inta2[MAX],int*c){inti,l1,l2;intlen,t1[MAX],t2[MAX];intk=0;l1=a1[MAX-1];l2=a2[MAX-1];if((a1[MAX-2]=='-')&&(a2[MAX-2]=='-')){mov(a1,t1);mov(a2,t2);t1[MAX-2]=0;t2[MAX-28、]=0;sub(t2,t1,c);return;标准文档实用文案}elseif(a2[MAX-2]=='-'){mov(a2,t2);t2[MAX-2]=0;add(a1,t2,c);retu
7、=(a2[i]+k)%10;k=(a2[i]+k)/10;}if(k!=0){c[l2]=k;len=l2+1;}elselen=l2;}c[99]=len;return;}voidsub(inta1[MAX],inta2[MAX],int*c){inti,l1,l2;intlen,t1[MAX],t2[MAX];intk=0;l1=a1[MAX-1];l2=a2[MAX-1];if((a1[MAX-2]=='-')&&(a2[MAX-2]=='-')){mov(a1,t1);mov(a2,t2);t1[MAX-2]=0;t2[MAX-2
8、]=0;sub(t2,t1,c);return;标准文档实用文案}elseif(a2[MAX-2]=='-'){mov(a2,t2);t2[MAX-2]=0;add(a1,t2,c);retu
此文档下载收益归作者所有