Function Reference


_Crypt_GenRandom

Fill a buffer with cryptographically random data

#include <Crypt.au3>
_Crypt_GenRandom ( $pBuffer, $iSize )

Parameters

$pBuffer Pointer to buffer to fill with random data.
$iSize Size of the buffer pointed to by $pBuffer.

Return Value

Success: True.
Failure: False and sets the @error flag to non-zero.

Remarks

Optionally, the application can fill this buffer with data to use as an auxiliary random seed.

See Also

Search CryptGenRandom in MSDN Library.

Example

#include <Crypt.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
        ; Generate 16 bytes of random data
        Local $tBuff = DllStructCreate("byte[16]")
        _Crypt_GenRandom($tBuff, DllStructGetSize($tBuff))
        MsgBox($MB_SYSTEMMODAL, "Random data:", DllStructGetData($tBuff, 1))
EndFunc   ;==>Example