Elgamal implementation problems
tg at gmplib.org
Sun May 1 13:31:46 CEST 2011
Andrew Mattingly <andrew_mattingly at au1.ibm.com> writes:
I can see two problems with your eg_encryption routine (eg_decryption has
1. you should be computing c2 = h^k * M mod p, not c2 = h^k * g^M mod p
2. even if you disagree with point 1, you should take a modulus after the
mpz_mul(cipherText->c2, tmp2, tmp);
mpz_mod(cipherText->c2, cipherText->c2, publicKey->p);
Hope this helps.
It is generally a disservice to the society to do student's homework for
Also, please do not use the GMP mailing list for such "help".
More information about the gmp-discuss