CryptoSys API Library Manual

RNG_NonceData

Returns a random nonce (number used once) as a specified-length byte array. This replaces the RNG_Nonce function from version 2.

VBA/VB6 Syntax

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

C/C++ Syntax

long __stdcall RNG_NonceData(unsigned char *lpOutput, long nBytes);

Parameters

lpOutput
[out] array to be filled with random values.
nBytes
[in] specifying the number of required bytes in the nonce.

Returns (VBA/C)

If successful, the return value is 0; otherwise it returns a non-zero error code.

.NET Equivalent

Rng.NonceBytes Method

C++ (STL) Equivalent

static bvec_t crsysapi::Rng::Bytes (int n)

Remarks

The array lpOutput must be at least nBytes bytes long.

Example

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

See Also

RNG_NonceDataHex RNG_Number RNG_KeyBytes

[Contents] [Index]

[PREV: RNG_MakeSeedFile...]   [Contents]   [Index]   
   [NEXT: RNG_NonceDataHex...]

Copyright © 2001-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-01-07T07:42:00Z.