When calling RAND_pseudo_bytes is it correct that the PRNG will not give the same result even though I have the same seed (I thought if I had the same seed I could get the same results each time)?

Thank you!

 

The below produces two different random numbers:

 

#include <openssl/ssl.h>

#include <openssl/err.h>

#include <openssl/rand.h>

 

RAND_cleanup();

 

unsigned char buf1[8];

unsigned char buf2[8];

 

unsigned char prng_seed[8] =

{ 0x6b, 0xa3, 0x4f, 0x07, 0xe4, 0x2a, 0xb0, 0xc };

RAND_seed( prng_seed, sizeof(prng_seed) );

 

RAND_pseudo_bytes( buf1, sizeof(buf1) );

RAND_pseudo_bytes( buf2, sizeof(buf2) );

 

for (int i=0; i<sizeof(buf1); i++)

printf("%02x", buf1[i]);

printf("\n\r");

 

for (int i=0; i<sizeof(buf2); i++)

printf("%02x", buf2[i]);

 

RAND_cleanup();

 

 

Reply via email to