AW: [sqlite] Obtaining randomness on win32

2007-01-29 Thread Christian Schwarz
> randomness as you need.  But I do not know how to do this on
> win32 and wince.  The current implementation seeds the random

As Michael already suggested, you should use the CryptoAPI
(CryptAquireContext, CryptGenRandom). This API is supported by all 32
bit desktop versions and by Windows CE starting with version 2.10.

Christian

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



AW: [sqlite] Obtaining randomness on win32

2007-01-29 Thread Michael Ruck
I'm not sure if this helps, but QueryPerformanceCounter could be
a source of semirandom 64-bit integers. It returns the processors
running time in nanoseconds. I'm not aware of anything, which returns
really random values.

On Windows itself you could use the CryptAcquireContext, CryptGenRandom 
and CryptReleaseContext. I think that doesn't work on WinCE though.

Michael

> -Ursprüngliche Nachricht-
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Gesendet: Montag, 29. Januar 2007 17:15
> An: sqlite-users@sqlite.org
> Betreff: [sqlite] Obtaining randomness on win32
> 
> The pseudo-random number generator (PRNG) in SQLite is 
> becoming more important so it seem good to make sure it is 
> well seeded.  On Unix this is easy - just open /dev/urandom 
> and read out as much randomness as you need.  But I do not 
> know how to do this on
> win32 and wince.  The current implementation seeds the random 
> number generator on these platforms by grabbing a copy of the 
> current system time.  See the sqlite3WinRandomSeed() function 
> in os_win.c for details.  This is not a very good method for 
> seeding a PRNG.
> 
> Can someone with more knowledge of win32 and wince please 
> suggest a better method for seeding the PRNG on those platforms?
> 
> --
> D. Richard Hipp  <[EMAIL PROTECTED]>
> 
> 
> --
> ---
> To unsubscribe, send email to [EMAIL PROTECTED]
> --
> ---
> 
> 


-
To unsubscribe, send email to [EMAIL PROTECTED]
-