0

I am implementing the exponential El Gamal cryptosystem (the same that El Gamal, but encrypting g**m when you wanna encrypt m). I am working with plain texts between 1 and 10**35. Everything is fine until the moment of the decryption corresponding to the bigger plain texts.

If cypher text is composed by c1 = g**r mod p and c2 = g**(ar) g**m mod p, with private key a, when decrypting, I can get the value of g**m mod p, but I can't calculate the discrete logarithm in a reasonable amount of time.

If I were working with smaller plain texts, I could calculate sequentially g%m, g**2%m,... until obtain the value of g**m mod p, and deduct the discrete logarithm. But, with big plain text this takes a lot of time.

I thought to precompute the values ​​of g%m,... g**(10**35)%m ​​(assuming the risk of leaking the private key), to avoid making the big calculus on each decryption.

In order to doing this, I develop a code that parallelizes the calculation of powers using Cuda (you can see more detail on this question). But I found Cuda doesn't support such big numbers as the value of g and p I am using :(

Do you know some technique, algorithm or tool I can use to calculate faster multiplications of big big numbers?

fermacias
  • 1
  • 1
  • 2
    Ultimately asking how to speed up your code requires you to include your code in the question. Also, I don't understand why you've modified El Gamal to require solving the discrete log problem to recover the message. There is an [algorithm](https://en.wikipedia.org/wiki/Baby-step_giant-step) that requires on the order of 10\*\*17.5 steps to solve the discrete log problem for your restricted domain but that is still way too hard for people with average computing resources. – President James K. Polk Nov 28 '22 at 01:02
  • Hi! I am using exponential el gamal instead of traditional el gamal becouse I need the homomorphic sum property (you can read more about this [here](https://nvotes.com/multiplicative-vs-additive-homomorphic-elgamal/)). I had previously read the algorithm you mention, but in my case is even more expensive. – fermacias Nov 28 '22 at 01:24
  • It's not computationally feasible to perform the discrete log on 10\*\*35 values. – President James K. Polk Nov 28 '22 at 02:02

0 Answers0