/* From honig@sprynet.com Wed Nov 11 10:37:58 1998 Date: Sat, 26 Sep 1998 16:27:49 -0700 From: David Honig To: cypherpunks@toad.com, coderpunks@toad.com Subject: Ueli Maurer's Univ. Stat. Test for Rand No -in C */ /* UELI.c This implements Ueli M Maurer's "Universal Statistical Test for Random Bit Generators" using L=16 Accepts a filename on the command line; writes its results, with other info, to stdout. Handles input file exhaustion gracefully. Ref: J. Cryptology v 5 no 2, 1992 pp 89-105 also on the web somewhere. -David Honig honig@sprynet.com Built with Wedit 2.3, lcc-win32 http://www.cs.virginia.edu/~lcc-win32 26 Sept CP Release Version Notes: This version does L=16. It evolved from an L=8 prototype which I ported from the Pascal in the above reference. I made the memory usage reasonable by replacing Maurer's "block" array with the 'streaming' fgetc() call. Usage: UELI filename outputs to stdout */ #define L 16 // bits per block #define V (1< #include int main( int argc, char **argv ) { FILE *fptr; int i; int b, c; int table[V]; float sum=0.0; int run; // Human Interface printf("UELI 26 Sep 98\nL=%d %d %d \n", L, V, MAXSAMP); if (argc <2) {printf("Usage: UELI filename\n"); exit(-1); } else printf("Measuring file %s\n", argv[1]); // FILE IO fptr=fopen(argv[1],"rb"); if (fptr == NULL) {printf("Can't find %s\n", argv[1]); exit(-1); } // INIT for (i=0; i