New answers tagged complexity
Well, there are some major problems with your code. Technically, the time estimate of your code is correct (that is, if you insert modulo operations when you update pow1 and pow2), however no one would actually use that algorithm to do ElGamal. Lets hit some of the issues: You use an $O(N)$ algorithm to compute $x^N$; in real usage, exponents are huge ...
Top 50 recent answers are included