Returns a random nonce (number used once) as a specified-length
byte array. This replaces the RNG_Nonce
function from version 2.
Public Declare Function RNG_NonceData Lib "diCryptoSys.dll"
(ByRef lpOutput As Byte, ByVal nBytes As Long) As Long
nRet = RNG_NonceData(lpOutput(0), nBytes)
' Note the "(0)" after the byte array parameters
long __stdcall RNG_NonceData(unsigned char *lpOutput, long nBytes);
If successful, the return value is 0; otherwise it returns a non-zero error code.
static bvec_t crsysapi::Rng::Bytes (int n)
The array lpOutput
must be at least nBytes
bytes long.
This example generates three nonces each 8 bytes long.
Dim abKey() As Byte Dim nRet As Long Dim nKeyBytes As Long Dim i As Integer nKeyBytes = 8 ReDim abKey(nKeyBytes - 1) ' Generate three successive 8-byte nonces For i = 1 To 3 nRet = RNG_NonceData(abKey(0), nKeyBytes) Debug.Print cnvHexStrFromBytes(abKey) Next
RNG_NonceDataHex
RNG_Number
RNG_KeyBytes