RSA 加密演算法:
- 給定兩不相等質數 p, q
- 計算
N = p*q, phi(N) = (p-1)*(q-1)
- 選擇
e
, 使得gcd(phi(N), e) = 1, 1 < e < phi(N)
- 計算
d = e^(-1) (mod phi(N))
加解密:text = M,M < N
- encryption:
C = M^e mode N
- decryption:
M = C^d mode N
詳見solve.py
Congratulations on decrypting an RSA message! Your flag is modular_arithmetics_not_so_bad_after_all