summaryrefslogtreecommitdiff
path: root/test/getentropy_test.c
blob: a3d02e6f518c41f8176af024c317621b745d5459 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <unistd.h>
#include <stdio.h>

int main() {
  unsigned char buf[16];
  if (getentropy(buf, sizeof(buf))) {
    perror("failed to getentropy()");
    return 1;
  }
  for (size_t i = 0; i < sizeof(buf); i++)
    printf("%02x", buf[i]);
  printf("\n");
  return 0;
}