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.
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)
long __stdcall RNG_HexWithPrompt(char *szOutput, long nMaxChars, long nBytes, const char *szPrompt, long nOptions);
If successful, the return value is 0. If the parameters are invalid, it returns a negative error code.
Rng.HexWithPrompt Method (Int32)
Rng.HexWithPrompt Method (Int32, String, Rng.Strength)
See the remarks for RNG_BytesWithPrompt
.
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