CryptRandomData()
语法
Result = CryptRandomData(*Buffer, Length)概要
Fills the specified memory buffer with random data from the cryptographic safe pseudorandom number generator.
参数
*Buffer The buffer to fill. Length The size of the buffer in bytes.
返回值
Returns nonzero if the random data was generated successfully and zero otherwise.
Remarks
The generator has to be opened first with the OpenCryptRandom() command.
To generate random data from the faster but not cryptographic safe pseudorandom number generator, use the RandomData() function.
示例
*Key = AllocateMemory(16) If OpenCryptRandom() And *Key CryptRandomData(*Key, 16) Text$ = "Generated Key:" For i = 0 To 15 Text$ + " " + RSet(Hex(PeekB(*Key+i), #PB_Byte), 2, "0") Next i CloseCryptRandom() Else Text$ = "Key generation is not available" EndIf MessageRequester("Example", Text$)
参阅
OpenCryptRandom(), CryptRandom(), CloseCryptRandom() RandomData()
已支持操作系统
所有