// output of ./demo/gf2n/gf2n-normal-demo.cc:
// Description:
//% Arithmetics over GF(2**n): conversion to normal basis representation.

arg 1: 5 == n  [degree of field]  default=5
args 2,3,... : [Optionally supply nonzero coefficients of field poly c]
  n = 5  GF(2^n)
  c = 1111.1 [normal] == x^5 + x^4 + x^3 + x^2 + 1  (polynomial modulus)
  mm= .11111   == 31 (prime)   (maximal order)
  h = .1.... (aux. bit-mask)
  g = ....1. (element of maximal order)
  tv= .11111 (traces of x^i)
tr1e= .....1 (element with trace=1)

P2N=
  11...
  1.11.
  1..11
  1..1.
  1....
N2P=
  ....1
  1...1
  .1.1.
  ...11
  ..11.
  k = bin(k):   f= g**k   == (normal)    t=trace(f)   
  0 = ..... :   f= ....1  ==  11111      t= 1
  1 = ....1 :   f= ...1.  ==  ....1      t= 1
  2 = ...1. :   f= ..1..  ==  ...1.      t= 1
  3 = ...11 :   f= .1...  ==  .111.      t= 1
  4 = ..1.. :   f= 1....  ==  ..1..      t= 1
  5 = ..1.1 :   f= 111.1  ==  1.111      t= 0
  6 = ..11. :   f= ..111  ==  111..      t= 1
  7 = ..111 :   f= .111.  ==  .11.1      t= 1
  8 = .1... :   f= 111..  ==  .1...      t= 1
  9 = .1..1 :   f= ..1.1  ==  111.1      t= 0
 10 = .1.1. :   f= .1.1.  ==  .1111      t= 0
 11 = .1.11 :   f= 1.1..  ==  ..11.      t= 0
 12 = .11.. :   f= 1.1.1  ==  11..1      t= 1
 13 = .11.1 :   f= 1.111  ==  11...      t= 0
 14 = .111. :   f= 1..11  ==  11.1.      t= 1
 15 = .1111 :   f= 11.11  ==  1.1..      t= 0
 16 = 1.... :   f= .1.11  ==  1....      t= 1
 17 = 1...1 :   f= 1.11.  ==  ..111      t= 1
 18 = 1..1. :   f= 1...1  ==  11.11      t= 0
 19 = 1..11 :   f= 11111  ==  1.11.      t= 1
 20 = 1.1.. :   f= ...11  ==  1111.      t= 0
 21 = 1.1.1 :   f= ..11.  ==  ...11      t= 0
 22 = 1.11. :   f= .11..  ==  .11..      t= 0
 23 = 1.111 :   f= 11...  ==  .1.1.      t= 0
 24 = 11... :   f= .11.1  ==  1..11      t= 1
 25 = 11..1 :   f= 11.1.  ==  .1.11      t= 1
 26 = 11.1. :   f= .1..1  ==  1...1      t= 0
 27 = 11.11 :   f= 1..1.  ==  ..1.1      t= 0
 28 = 111.. :   f= 11..1  ==  1.1.1      t= 1
 29 = 111.1 :   f= .1111  ==  1..1.      t= 0
 30 = 1111. :   f= 1111.  ==  .1..1      t= 0
