diff options
Diffstat (limited to 'rsa.cpp')
-rw-r--r-- | rsa.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -0,0 +1,12 @@ +#include <cassert> +#include "numalgo.h" +#include "rsa.h" + +Bigint encrypt(const PublicKey &pubkey,Bigint msg){ + assert(msg>1&&msg<pubkey.mod); + return expmod(msg,pubkey.exp,pubkey.mod); +} + +Bigint decrypt(const PrivateKey &privkey,Bigint encr){ + return expmod(encr,privkey.pexp,privkey.pub.mod); +} |