English Spanish
sum += log((double)(j-table[b]));
table[b] = i;
}
}
if (b < 0)
run = 0;
if (run) {
if (table[b] > j)
j += K;
/* refill initial table */
if (0) {
for (i = 0; i < Q; i++) {
b = fgetc(fptr);
if (b < 0) {
run = 0;
} else {
table[b] = i;
}
}
}
}
}
for (i = 0; i < (int)(sum*8.0 + 0.50); i++)
printf("-");
if (!run)
printf("Premature end of file; read %d blocks.\n", i - Q);
if (run)
for (i = Q; run && i < Q + K; i++) {
j = i;
b = fgetc(fptr);
printf("\n");
sum = (sum/((double)(i - Q))) / log(2.0);
printf("%4.4f ", sum);
-David Honig
honig@sprynet.com
1 Oct 98
1 Dec 98
21 Dec 98 uliscan.c derived from ueli8.c
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, which is where I found it.
This implements Ueli M Maurer's "Universal Statistical Test for Random
Bit Generators" using L=8
This version has // comments removed for Sun cc
Usage:
ULISCAN filename
outputs to stdout
*/
extern double log(/* double x */);
for (i = 0; i < Q; i++) {
b = fgetc(fptr);
table[b] = i;
}