1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-20 10:37:24 -07:00
libsodium/test/default/randombytes.c
2014-09-14 11:32:55 -07:00

30 lines
454 B
C

#include "randombytes.h"
unsigned char x[65536];
unsigned long long freq[256];
static int nacl_tests(void)
{
unsigned long long i;
randombytes(x, sizeof x);
for (i = 0; i < 256; ++i) {
freq[i] = 0;
}
for (i = 0; i < sizeof x; ++i) {
++freq[255 & (int)x[i]];
}
for (i = 0; i < 256; ++i) {
if (!freq[i]) {
return 111;
}
}
}
int main(void)
{
nacl_tests();
return 0;
}