shrub/sample.c

25 lines
323 B
C
Raw Normal View History

2018-12-27 22:19:59 +03:00
#include <stdio.h>
2018-12-28 05:43:23 +03:00
#include <stdlib.h>
2018-12-27 22:19:59 +03:00
#include <string.h>
#include <ent.h>
2018-12-27 22:19:59 +03:00
int
main()
{
char buf[256];
int i;
memset(buf, 0, sizeof(buf));
if (0 != ent_getentropy(buf, sizeof(buf))) {
perror("getentropy");
2018-12-28 05:43:23 +03:00
exit(1);
2018-12-27 22:19:59 +03:00
}
for (i = 0; i < sizeof buf; ++i) {
printf("%02hhx", buf[i]);
}
puts("");
return 0;
}