hdu1211
来源:互联网 发布:windows音量管理工具 编辑:程序博客网 时间:2024/05/08 18:20
RSA is one of the most powerful methods to encrypt data. The RSA algorithm is described as follow:
> choose two large prime integer p, q
> calculate n = p × q, calculate F(n) = (p - 1) × (q - 1)
> choose an integer e(1 < e < F(n)), making gcd(e, F(n)) = 1, e will be the public key
> calculate d, making d × e mod F(n) = 1 mod F(n), and d will be the private key
M = D(c) = cd mod n
RSA 加密
#include <stdio.h>int main(){ int i,j,p,q,e,l,c,d,m; __int64 fn,n; while(scanf("%d%d%d%d",&p,&q,&e,&l)!=EOF) { n=p*q; fn=(p-1)*(q-1); for(i=0;;i++) if((i*fn+1)%e==0) { d=(i*fn+1)/e; break; } for(i=0; i<l; i++) { scanf("%d",&c); m=1; for(j=1; j<=d; j++) { m=(m*c)%n; } printf("%c",m); } printf("\n"); } return 0;}
0 0
- HDU1211
- hdu1211
- hdu1211
- hdu1211
- HDU1211 RSA
- RSA HDU1211
- HDU1211 RSA 基础
- HDU1211 RSA【公匙密码】
- hdu1211(RSA)(扩展欧几里得+快速幂+快速乘)
- hdu1211(模的逆元、扩展欧几里得)
- 快速幂模-蒙哥马利-递推-HDU4506-HDU1211-HDU1575
- Android SDK Manager无法更新
- 问题记录:每次移动相机是否需要重新标定(已解决)
- android项目程序实现完全退出程序
- 基于用例点来度量软件规模并管理进度 之一
- new
- hdu1211
- 【分治法】子数组换位问题
- Extjs4.2 ajax请求url中传中文参数乱码问题
- 给电脑全面提速7大绝招
- 20060207-Spatial transformations: Affine
- 视觉SLAM漫谈
- 新辰:小白做SEO的回忆录 艰辛压不倒希望 坚持就是胜利
- (二)高可用性解决方案之日志传送
- OpenVpn+BGP协议实现双线路由动态切换