3
1
Your task is to build a function in any language that takes a message m
, an encryption e
, and a modulus k
(all positive integers), and takes m
to the power of e
modulo k
. Your solution must not be a theoretical one, but one that would work on a reasonable computer such as your own, for RSA keys of currently used sizes such as 2048 bits.
Shortest code wins.
How are you measuring memory usage? Does this implicitly forbid using big integer libraries unless they come with documented guarantees about their memory usage? – Peter Taylor – 2013-02-15T18:47:53.857
2(And if you're going to post a challenge about RSA, why not make it interesting by asking for an implementation of real RSA as opposed to academic useless-for-protecting-secrets RSA?) – Peter Taylor – 2013-02-15T18:48:47.227
@PeterTaylor: Big-integer libraries are fine. The main point of the limit is to prevent people from trying to store the entire exponentiated number and then evaluating it modulo
m
. – Joe Z. – 2013-02-15T18:50:47.863@PeterTaylor: Also, you can pose the question that includes PKCS #1 if you want. – Joe Z. – 2013-02-15T18:53:41.637