Skip to content

Instantly share code, notes, and snippets.

@endreszabo
Created December 4, 2012 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save endreszabo/4209270 to your computer and use it in GitHub Desktop.
Save endreszabo/4209270 to your computer and use it in GitHub Desktop.
usin intel's ivy-bridge rdrand hrng
#include <stdio.h>
#include <string.h>
#include "rdrand.h"
#define BUFFSIZE 65536
int main()
{
int r;
unsigned char buffer[BUFFSIZE];
memset(buffer, 0, BUFFSIZE);
while(1) {
r = rdrand_get_bytes(BUFFSIZE, buffer);
if ( r == RDRAND_SUCCESS ) {
write(1,buffer,BUFFSIZE);
} else printf("rdrand fakap: %d\n", r);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment