I know that Elgamal algorithms have fallen out of fashion, and they are not included in any widespread cryptographic standard nowadays. However, they are still present in several popular crypto libraries (bouncy castle, botan, cryptopp, etc). One disturbing thing I found is that such libraries have no or very limited test vectors for Elgamal.

Do test vectors exist at all for Elgamal? What is a good reference? I especially refer to encryption and signing algorithms over $Z_p$.


2 Answers 2


There seem to be no standardized ElGamal test vectors available in the public domain. However, there are some ElGamal test vectors generated with libgcrypt 1.5.0 available in this fork of the pycrypto project.


I've created my own set of ElGamal test vectors of varying number of bits. I can't guarantee that they are correct, except that they pass my own implementation.


  • 1
    $\begingroup$ Just curious: how did you verify your own implementation without test vectors? Users might want to know to be able to assess if and how much they can trust your "random test vectors without guarantee of correctness". $\endgroup$
    – e-sushi
    Commented Sep 2, 2017 at 0:30
  • $\begingroup$ It's a chicken and an egg problem! I found about 6 test vectors online though, either from existing implementations, or from small worked through examples. My implementation worked with those few test vectors. I'll add a comment to my gist as such. $\endgroup$
    – dsmith
    Commented Sep 2, 2017 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.