Resets the HASH context.
Public Declare Function HASH_Reset Lib "diCryptoSys.dll" (ByVal hContext As Long) As Long
nRet = HASH_Reset(hContext)
long __stdcall HASH_Reset(long hContext);
If successful, the return value is 0; otherwise it returns a non-zero error code.
Destroys the existing context. The results of any part-messages added to the context will be lost.
This trivial example creates a context handle for SHA-1, gets the output length in bytes (expecting 20), and then destroys it.
Dim hContext As Long Dim r As Long hContext = HASH_Init(API_HASH_SHA1) Debug.Print "HASH_Init returns 0x" & Hex(hContext) & " (expected nonzero)" Debug.Print "HASH_DigestLength = " & HASH_DigestLength(hContext) r = HASH_Reset(hContext) Debug.Print "After reset, HASH_DigestLength returns " & HASH_DigestLength(hContext) Debug.Print "API_ErrorCode=" & API_ErrorCode() & ": " & apiErrorLookup(API_ErrorCode()) hContext = HASH_Init(&HFF) ' Invalid hash alg code Debug.Print "HASH_Init(INVALID) returns 0x" & Hex(hContext) Debug.Print "API_ErrorCode=" & API_ErrorCode() & ": " & apiErrorLookup(API_ErrorCode())
HASH_Init returns 0x19050DD5 (expected nonzero) HASH_DigestLength = 20 After reset, HASH_DigestLength returns -64 API_ErrorCode=64: Invalid context handle (INVALID_HANDLE_ERROR) HASH_Init(INVALID) returns 0x0 API_ErrorCode=19: Item is not supported (NOT_SUPPORTED_ERROR)