RSA加密¶
1. 选择两个质数¶
p=3 ,q=11
2.计算¶
n =( p * q )
n = 3 * 11
3.计算欧拉函数¶
φ(n) = ( p − 1 )( q − 1 )
φ(n) = ( 3 - 1 )( 11 -1 )
φ(n) = 20
4.公钥¶
e 1 < e < φ(n) 且(e, φ(n) ) = 1 互质
1 < e < 20
e = 3
5.私钥¶
d (e * d ) % m = 1
d = 7
6.加密算法¶
m(明文)^e % n = c(密文)
4^3 % 33 = 31
7.解密算法¶
c(密文)^d % n = m(明文)
31^7 % 33 = 4