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.

VB6/VBA 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)

Parameters

strOutput
[out] String of sufficient length to receive the output.
nMaxChars
[in] Long specifying the maximum number of characters in strOutput.
strPrompt
[in] String specifying an (optional) prompt for the dialog. Specify an empty string ("") or NULL to use the default dialog.
nOptions
[in] Long 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

C/C++ Syntax

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

Returns (VB6/C)

Long: 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]

[HOME]   [NEXT: RNG_Initialize...]

Copyright © 2001-11 D.I. Management Services Pty Ltd. All rights reserved.