AMDG Ovanes Markarian wrote:
On Thu, Feb 11, 2010 at 5:58 AM, Steven Watanabe
wrote: uint64_t seed; memcpy(&seed, &randomBytes[0], sizeof(seed));
at first this solution seemed to me pretty cool. As far as I understand seed will contain some value from stack. The only question is how probable is it, that seed is always initialized with a different value?
I was assuming that the code I wrote was prefixed with HCRYPTPROV hProvider = 0; BYTE randomBytes[8]; CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); CryptGenRandom(hProvider, sizeof(randomBytes), randomBytes); CryptReleaseContext(hProvider, 0); The memcpy should copy from randomBytes into seed. (Assuming I haven't forgotten the signature of memcpy.) In Christ, Steven Watanabe