
#include <crypto/crypto.h>

NTL_CLIENT

GF2X hex_to_GF2X(const ostring& s)
{
	ZZ z = hex_to_ZZ(s);
	ostring t = i2osp(z, NumBytes(z));
	return os2polyp(t);
}

int main()
{
	GF2X p, a, b, x, y;
	ZZ n;

	SetCoeff(p, 163);
	SetCoeff(p, 7);
	SetCoeff(p, 6);
	SetCoeff(p, 3);
	SetCoeff(p, 0);

	a = 1;
	b = hex_to_GF2X(ostring("020a601907b8c953ca1481eb10512f78744a3205fd"));
	x = hex_to_GF2X(ostring("03f0eba16286a2d57ea0991168d4994637e8343e36"));
	y = hex_to_GF2X(ostring("00d51fbc6c71a0094fa2cdd545b11c5c0c797324f1"));

	n = hex_to_ZZ(ostring("040000000000000000000292fe77e70c12a4234c33"));

	if ((( y*y + x*y + x*x*x + a*x*x + b ) % p) != 0)
		cerr << "not on curve\n";

	if (!ProbPrime(n))
		cerr << "not prime\n";

	GF2X::HexOutput = 1;

	cout << p << "\n";
	cout << a << "\n";
	cout << b << "\n";
	cout << n << "\n";
	cout << "1" << "\n";  // index
	cout << "0" << "\n";  // inf
	cout << x << "\n";
	cout << y << "\n";

}
