RNG_NonceData 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 abOutput As Byte, ByVal nBytes As Long) As Long
nRet = RNG_NonceData(abOutput(0), nBytes)
Byte array to be filled with
random values.Long specifying the number of
required bytes in the nonce.
long _stdcall RNG_NonceData(unsigned char *bytearray, long nbytes);
Long: If successful, the return value is 0;
otherwise it returns a non-zero error code.
The array abOutput must be at least nBytes bytes long.
Note the (0) in abOutput(0) for VB6.
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