CryptoSys API Library Manual

HASH_Reset

Resets the HASH context.

VBA/VB6 Syntax

Public Declare Function HASH_Reset Lib "diCryptoSys.dll" (ByVal hContext As Long) As Long

nRet = HASH_Reset(hContext)

C/C++ Syntax

long __stdcall HASH_Reset(long hContext);

Parameters

hContext
[in] handle to the HASH context.

Returns (VBA/C)

If successful, the return value is 0; otherwise it returns a non-zero error code.

.NET Equivalent

Hash.Reset Method

Remarks

Destroys the existing context. The results of any part-messages added to the context will be lost.

Example

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)

See Also

HASH_Init

[Contents] [Index]

[PREV: HASH_Length...]   [Contents]   [Index]   
   [NEXT: MAC_AddBytes...]

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