Skip to content

Instantly share code, notes, and snippets.

@bricef
Created April 22, 2012 16:00
Show Gist options
  • Save bricef/2464895 to your computer and use it in GitHub Desktop.
Save bricef/2464895 to your computer and use it in GitHub Desktop.
Generating an IV in C
int genIV(
void* buffer,
int buffer_len
){
/*
* Note that we propagate the return code from the library called.
*/
#ifndef _WIN32
return RAND_bytes(buffer, buffer_len);
#else
return RtlGenRandom(buffer, buffer_len);
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment