2

I'm learning NTL and I have a doubt: How will I be able to get any specific element of any finite field?

Here is my code

GF2X P = BuildIrred_GF2X(256);
GF2E::init(P);

GF2E zero = GF2E::zero();
GF2E one;
GF2E r = random_GF2E(); //I want change the function random_GF2E()

I want change the function random_GF2E() by any other to get a specific element.

AbcAeffchen
  • 14,400
  • 15
  • 47
  • 66
Juan
  • 2,073
  • 3
  • 22
  • 37

1 Answers1

1

The Elements of a finite field with 2256 elements are represented as the polynomials f of deg(f) < 256.

If you want a special element, you can declare a polynom p by something like

GF2X p;
p.SetLength(n);
SetCoeff(p,i,1);

There is deg(p) = n. If n < deg(P) (in your case n < 256), then this is a special element of the finite field. If n >= deg(P) you can reduce it modulo P by conv<GF2E>(p).

I hope this is what you were looking for.

AbcAeffchen
  • 14,400
  • 15
  • 47
  • 66