CryptoSys API Library Manual

RNG_HexWithPrompt

Generates a random set of data in hexadecimal format suitable for cryptographic keys with a prompt for the user to enter random keystrokes and mouse movements.

VBA/VB6 Syntax

Public Declare Function RNG_HexWithPrompt Lib "diCryptoSys.dll" (ByVal strOutput As String, ByVal nMaxChars As Long, ByVal nBytes As Long, ByVal strPrompt As String, ByVal nOptions As Long) As Long

nRet = RNG_HexWithPrompt(strOutput, nMaxChars, strPrompt, nOptions)

C/C++ Syntax

long __stdcall RNG_HexWithPrompt(char *szOutput, long nMaxChars, long nBytes, const char *szPrompt, long nOptions);

Parameters

szOutput
[out] of sufficient length to receive the output.
nMaxChars
[in] specifying the maximum number of characters in szOutput.
nBytes
[in] value of the required random data length in bytes.
szPrompt
[in] specifying an (optional) prompt for the dialog. Specify an empty string ("") or NULL to use the default dialog.
nOptions
[in] option flags:
API_DEFAULT (0) for default options
API_RNG_STRENGTH_112 to make user generate an estimated 112 bits of security (default)
API_RNG_STRENGTH_128 to make user generate an estimated 128 bits of security
API_RNG_STRENGTH_192 to make user generate an estimated 192 bits of security
API_RNG_STRENGTH_256 to make user generate an estimated 256 bits of security

Returns (VBA/C)

If successful, the return value is 0. If the parameters are invalid, it returns a negative error code.

.NET Equivalent

Rng.HexWithPrompt Method (Int32)
Rng.HexWithPrompt Method (Int32, String, Rng.Strength)

Remarks

See the remarks for RNG_BytesWithPrompt.

Example

Dim strHexData As String
Dim nBytes As Long

' Allocate output string for 16 bytes = 2 x the number of bytes
nBytes = 16
strHexData = String(nBytes * 2, " ")

' Default prompt with default 112-bit security strength
Call RNG_HexWithPrompt(strHexData, Len(strHexData), nBytes, "", 0)
Debug.Print strHexData

' User-selected prompt with 128-bit security strength
Call RNG_HexWithPrompt(strHexData, Len(strHexData), nBytes, "Our own prompt: type until done...", API_RNG_STRENGTH_128)
Debug.Print strHexData

See Also

RNG_KeyHex

[Contents] [Index]

[PREV: RNG_BytesWithPrompt...]   [Contents]   [Index]   
   [NEXT: RNG_Initialize...]

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