CodeBus
www.codebus.net
Search
Sign in
Sign up
Hot Search :
Source
embeded
web
remote control
p2p
game
More...
Location :
Home
Search - c select
Main Category
SourceCode
Documents
Books
WEB Code
Develop Tools
Other resource
Search - c select - List
[
CA auth
]
456
DL : 0
RSA算法的C语言实现 1.密钥的产生 (1)选两个安全的大素数p和q。 (2)计算n=p×q,φ(n)=(p-1)(q-1),其中φ(n)是n的欧拉函数值。 (3)选一整数e,满足1<e<φ(n),且gcd(φ(n),e)=1。 (4)计算d,满足de≡1 modφ(n),即d是e在模φ(n)下的乘法逆元,因e与φ(n)互素,由模运算可知,它的乘法逆元一定存在。 (5)以{e,n}为公开钥,{d,n}为秘密钥。 2.加密 加密时首先将明文M比特串分组,使得每个分组对应的十进制数小于n,即分组的长度小于log(2)n。然后对每组明文分组,作加密运算:C=M^e(mod n) 3.解密 对密文分组的解密运算为:M=C^d(mod n)-C language implementation of the RSA algorithm 1. Generated keys (1) Select two safe primes p and large q. (2) calculate n = pq, φ (n) = (p-1) (q-1), where φ (n) is the Euler function value of n. (3) Select an integer e, meet a <e<φ(n),且gcd(φ(n),e)=1。 (4)计算d,满足de≡1 modφ(n),即d是e在模φ(n)下的乘法逆元,因e与φ(n)互素,由模运算可知,它的乘法逆元一定存在。 (5)以{e,n}为公开钥,{d,n}为秘密钥。 2.加密 加密时首先将明文M比特串分组,使得每个分组对应的十进制数小于n,即分组的长度小于log(2)n。然后对每组明文分组,作加密运算:C=M^e(mod n) 3.解密 对密文分组的解密运算为:M=C^d(mod n)
Date
: 2025-12-23
Size
: 2kb
User
:
qwerty
CodeBus
is one of the largest source code repositories on the Internet!
Contact us :
1999-2046
CodeBus
All Rights Reserved.