Group: Cryptography Reference - Library: advapi32
How to fill a buffer with random bytes using Cryptography API Functions
BOOL WINAPI CryptGenRandom(
HCRYPTPROV hProv,
DWORD dwLen,
BYTE* pbBuffer
); DECLARE INTEGER CryptGenRandom IN advapi32;
INTEGER hProv,;
LONG dwLen,;
STRING @pbBuffer hProv [in] Handle of a cryptographic service provider (CSP) created by a call to CryptAcquireContext.
dwLen [in] Number of bytes of random data to be generated.
pbBuffer [in, out] Buffer to receive the returned data.
If the function succeeds, the return value is nonzero (TRUE).
The data produced by this function is cryptographically random. It is far more random than the data generated by the typical random number generator such as the one shipped with your C compiler.
Home