Fill a buffer with cryptographically random data
#include <Crypt.au3>
_Crypt_GenRandom ( $pBuffer, $iSize )
$pBuffer | Pointer to buffer to fill with random data. |
$iSize | Size of the buffer pointed to by $pBuffer. |
Success: | True. |
Failure: | False and sets the @error flag to non-zero. |
Optionally, the application can fill this buffer with data to use as an auxiliary random seed.
Search CryptGenRandom in MSDN Library.
#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