RSA

公開鍵暗号方式

Haskell で復号する例

import Crypto.Number.ModArithmetic
crackRSA :: Integer -> Integer -> Integer -> Integer -> Integer
crackRSA p q e c = expSafe c d n
where
l = lcm (p-1) (q-1)
d = inverseCoprimes e l
n = p * q