Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 1.24 KB

File metadata and controls

57 lines (39 loc) · 1.24 KB

Home

Function name : CryptGenRandom

Group: Cryptography Reference - Library: advapi32


Fills a buffer with cryptographically random bytes.


Code examples:

How to fill a buffer with random bytes using Cryptography API Functions

Declaration:

BOOL WINAPI CryptGenRandom(
	HCRYPTPROV hProv,
	DWORD dwLen,
	BYTE* pbBuffer
);  

FoxPro declaration:

DECLARE INTEGER CryptGenRandom IN advapi32;
	INTEGER hProv,;
	LONG dwLen,;
	STRING @pbBuffer  

Parameters:

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.


Return value:

If the function succeeds, the return value is nonzero (TRUE).


Comments:

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.