RSA
Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 580Accepted Submission(s): 432
Problem Description
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
You can encrypt data with this method :
C = E(m) = me mod n
When you want to decrypt data, use this method :
M = D(c) = cd mod n
Here, c is an integer ASCII value of a letter of cryptograph and m is an integer ASCII value of a letter of plain text.
Now given p, q, e and some cryptograph, your task is to "translate" the cryptograph into plain text.
Input
Each case will begin with four integers p, q, e, l followed by a line of cryptograph. The integers p, q, e, l will be in the range of 32-bit integer. The cryptograph consists of l integers separated by blanks.
Output
For each case, output the plain text in a single line. You may assume that the correct result of plain text are visual ASCII letters, you should output them as visualable letters with no blank between them.
Sample Input
101 103 7 11
7716 7746 7497 126 8486 4708 7746 623 7298 7357 3239
Sample Output
Author
JGShining(极光炫影)
Source
本题详细的介绍了RSA加密法
可以学习下
我的代码:
分享到:
相关推荐
收集的部分HDOJ杭电ACM题的代码 大牛勿下 全是基础供初级acmer使用
自己积累的部分杭电oj的(hdu)解题代码。。大家有空来看看。 基本上是自己写的哈。有错误之处请指教、
杭电oj4405,一道简单的概率dp题目
HDU信息安全密码学实验RSA源码
杭电acm解题报告 详细解析2000-2099 适合acm初学者
ACM ICPC HDOJ1000
杭州电子科技大学hdoj1002,大整数相加问题
HDU的1250,主要是利用高精度加法,但是代码有点繁琐,效率不是很高
ACM_HDU 我的 acm 问题的一部分在 hdoj 中解决了。
HDU ACM 2005第几天 C++ http://acm.hdu.edu.cn/listproblem.php?vol=11 2005题 第几天?
hdoj的一些题目分类,由hdu大牛搜集,希望对做ac的同志们有帮助
HDU1059的代码
杭电ACMhdu1163
hdu1001解题报告
HDU的一题........HDU DP动态规
hdu 1574 passed sorce
ACM ICPC HDOJ 1005
hdu acm 教案 搜索入门 hdu acm 教案 搜索入门
ACM ICPC HDOJ1004