Search code examples
opensslbignumntl

Can ZZ from NTL be used to represent big numbers needed fro crypto?


I'm trying to implement Threshold Elgamal and I need a library that supports both big numbers and polynomials. For polynomials I would use NTL and for big numbers I would choose openssl bignum. The problem is that the big numbers must be the coefficients of the polynomials, which in NTL are either ZZ or ZZ_p.

The description of ZZ says: "big integers": signed, arbitrary length integers.

Is this enough?


Solution

  • ZZ can store any integer you want.

    ZZ_p represents numbers modulo p (any intager, not necessarily prime), where p is of type ZZ, so it can also be any (positive) integer you want.

    The classes for polynomials are ZZX and ZZ_pX. Here is the limitation, that the degree of the polynomials have to be of type long, so I think it has an upper bound of 2³¹-1, since the degree is a signed long and the zero polynomial has degree -1 (by definition in NTL).

    But notice, that you should compile NTL with GMP to get the best performance using big integers.