欢迎来到天天文库
浏览记录
ID:36060974
大小:91.50 KB
页数:30页
时间:2019-05-02
《rsa加解密算法c语言的实现》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、word完美格式#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]来标记实际长度
2、*/structslink*next;};/*/--------------------------------------自己建立的大数运算库-------------------------------------*/voidprint(inta[MAX]){inti;for(i=0;i3、2=a2[99];if(l1>l2)return1;if(l1=0;i--){if(a1[i]>a2[i])return1;if(a1[i]4、ntz;intw;intl1,l2;l1=a1[MAX-1];l2=a2[MAX-1];if(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、/10;c[w]=c[w]%10;}}精心整理学习帮手word完美格式w=l1+l2;if(c[w-1]==0)w=w-1;c[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(a16、,temp);temp[MAX-2]=0;sub(a2,temp,c);return;}elseif(a2[MAX-2]=='-'){mov(a2,temp);temp[98]=0;sub(a1,temp,c);return;}if(l1len){for(i=len;i7、[i]+k)%10;k=(a1[i]+k)/10;}if(k!=0){c[l1]=k;len=l1+1;}elselen=l1;}else{for(i=len;i8、=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]=0;sub(t2,t1,c);return;精心整理学习帮手word完美格式}elseif(a2[MAX-2]=='-'){mov(
3、2=a2[99];if(l1>l2)return1;if(l1=0;i--){if(a1[i]>a2[i])return1;if(a1[i]4、ntz;intw;intl1,l2;l1=a1[MAX-1];l2=a2[MAX-1];if(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、/10;c[w]=c[w]%10;}}精心整理学习帮手word完美格式w=l1+l2;if(c[w-1]==0)w=w-1;c[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(a16、,temp);temp[MAX-2]=0;sub(a2,temp,c);return;}elseif(a2[MAX-2]=='-'){mov(a2,temp);temp[98]=0;sub(a1,temp,c);return;}if(l1len){for(i=len;i7、[i]+k)%10;k=(a1[i]+k)/10;}if(k!=0){c[l1]=k;len=l1+1;}elselen=l1;}else{for(i=len;i8、=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]=0;sub(t2,t1,c);return;精心整理学习帮手word完美格式}elseif(a2[MAX-2]=='-'){mov(
4、ntz;intw;intl1,l2;l1=a1[MAX-1];l2=a2[MAX-1];if(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、/10;c[w]=c[w]%10;}}精心整理学习帮手word完美格式w=l1+l2;if(c[w-1]==0)w=w-1;c[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(a16、,temp);temp[MAX-2]=0;sub(a2,temp,c);return;}elseif(a2[MAX-2]=='-'){mov(a2,temp);temp[98]=0;sub(a1,temp,c);return;}if(l1len){for(i=len;i7、[i]+k)%10;k=(a1[i]+k)/10;}if(k!=0){c[l1]=k;len=l1+1;}elselen=l1;}else{for(i=len;i8、=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]=0;sub(t2,t1,c);return;精心整理学习帮手word完美格式}elseif(a2[MAX-2]=='-'){mov(
5、/10;c[w]=c[w]%10;}}精心整理学习帮手word完美格式w=l1+l2;if(c[w-1]==0)w=w-1;c[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
6、,temp);temp[MAX-2]=0;sub(a2,temp,c);return;}elseif(a2[MAX-2]=='-'){mov(a2,temp);temp[98]=0;sub(a1,temp,c);return;}if(l1len){for(i=len;i7、[i]+k)%10;k=(a1[i]+k)/10;}if(k!=0){c[l1]=k;len=l1+1;}elselen=l1;}else{for(i=len;i8、=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]=0;sub(t2,t1,c);return;精心整理学习帮手word完美格式}elseif(a2[MAX-2]=='-'){mov(
7、[i]+k)%10;k=(a1[i]+k)/10;}if(k!=0){c[l1]=k;len=l1+1;}elselen=l1;}else{for(i=len;i8、=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]=0;sub(t2,t1,c);return;精心整理学习帮手word完美格式}elseif(a2[MAX-2]=='-'){mov(
8、=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]=0;sub(t2,t1,c);return;精心整理学习帮手word完美格式}elseif(a2[MAX-2]=='-'){mov(
此文档下载收益归作者所有