1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-28 22:21:15 -07:00
libsodium/test/default/randombytes.c

24 lines
396 B
C
Raw Normal View History

#include "randombytes.h"
2013-01-20 15:03:05 -07:00
unsigned char x[65536];
unsigned long long freq[256];
int main(void)
{
unsigned long long i;
2013-01-20 15:03:05 -07:00
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;
}
}
return 0;
2013-01-20 15:03:05 -07:00
}