CryptoSys API examples VB6 to VB.NET

RNG_NonceDataHex

Returns a specified-length random nonce (number used once) as a hexadecimal string.

VB6/VBA

Debug.Print "Testing RNG_NonceDataHex ..."
Dim sHexData As String
Dim nRet As Long
Dim nBytes As Long

nBytes = 20
' Set hex string length to 2 x # bytes required.
sHexData = String(2 * nBytes, " ")
nRet = RNG_NonceDataHex(sHexData, Len(sHexData), nBytes)
Debug.Print sHexData

Output

Testing RNG_NonceDataHex ...
B9F8EBEC8D671C7C9F4A04F20AC73D790A29084F

VB.NET

Console.WriteLine("Testing RNG_NonceDataHex ...")
Dim sHexData As String
''Dim nRet As Integer
Dim nBytes As Integer

nBytes = 20
' Set hex string length to 2 x # bytes required.
''sHexData = String(2 * nBytes, " ")
sHexData = Rng.NonceHex(nBytes)
Console.WriteLine(sHexData)

[Contents]

[HOME]   [NEXT: RNG_Number...]

Copyright © 2009-20 D.I. Management Services Pty Ltd. All rights reserved.