/* implementation of noam nisan's prng which fools all statistical tests in L. uses NTL for GF(2^n) and GF(2^n)[x] arithmetic. written by seth hardy, shardy@aculei.net license-ish thing: you can use this code if you give credit where credit is due. I assume no responsibility for what happens if you use it, though. */ #include #include #include #include #include #include #include #include char buf = 0; int pos = 0; void R(FILE *, int, int, GF2E, GF2E[][2]); int main(int argc, char **argv) { int t, k; GF2X irr; FILE *out; if( argc != 4 ) { printf("\nusage: %s wordsize levels filename\n\n",argv[0]); exit(1); } srandom(time(NULL)); GF2X::HexOutput = 1; t = atoi(argv[1]); k = atoi(argv[2]); out = fopen(argv[3],"w"); cout << "using field of size 2^" << t; cout << " and " << k << " levels of recursion." << endl; irr = BuildSparseIrred_GF2X(t); GF2E::init(irr); GF2E x; x = random_GF2E(); cout << "random seed x: " << x << endl; GF2E h[64][2]; for(int i=0;i