RSA算法原理的简单实现
来源:互联网 发布:敏感词过滤算法 python 编辑:程序博客网 时间:2024/05/17 06:42
#include <stdio.h>int candp(int a,int b,int c){ int r=1;b=b+1;while(b!=1){ r=r*a; r=r%c; b--;}printf("%d\n",r);return r;}void main(){int p,q,e,d,m,n,t,c,r;char s;printf("please input the p,q: ");scanf("%d%d",&p,&q);n=p*q;printf("the n is =\n",n);t=(p-1)*(q-1);printf("the t is =\n",t);printf("please input the e: ");scanf("%d",&e);if(e<1||e>t){ printf("e is error,please input again: "); scanf("%d",&e);}d=1;while(((e*d)%t)!=1) d++;printf("then caculate out that the d is %d\n",d);printf("the cipher please input 1\n");printf("the plain please input 2\n");scanf("%d",&r);switch(r){ case 1: printf("input the m: "); scanf("%d",&m); c=candp(m,e,n); printf("the cipher is %d\n",c);break; case 2: printf("input the c: "); scanf("%d",&c); m=candp(c,d,n); printf("the cipher is %d\n",m);break;}getch();}
0 0
- RSA算法原理的简单实现
- RSA算法的简要实现(其实原理非常简单)
- RSA算法的简单实现
- RSA算法Java的简单实现
- 基于python的简单 RSA算法实现
- RSA算法的原理
- RSA的实现原理
- RSA算法的实现
- RSA算法的实现
- RSA公钥密码算法的原理及实现(一)
- RSA公钥密码算法的原理及实现(二)
- RSA公钥密码算法的原理及实现
- RSA公钥密码算法的原理及实现(一)
- RSA公钥密码算法的原理及实现(二)
- RSA公钥密码算法的原理及实现(一)
- RSA公钥密码算法的原理及实现(二)
- RSA公钥密码算法的原理及实现(一)
- RSA算法的数学原理
- Dedicated Server Architecture&Shared Server Architecture
- Linux虚拟化基础之命名空间
- hdu 1561The more, The Better(树形dp&01背包)
- Oracle Statspack报告中各项指标含义详解~~学习性能必看!!!
- 从瀑布模型到极限编程,敏捷开发
- RSA算法原理的简单实现
- log4net Tutorial
- xx duplicate symbols for architecture i386的问题
- TCP/IP、Http的区别
- tomcat6 参数优化
- oozie3.3.2-cdh4.5.0运行官方示例sqoop
- logcat命令详解
- 单链表逆序
- SPM8