CryptDestroyHash

This function destroys the hash object referenced by the hHash parameter. Once a hash object has been destroyed, it can no longer be used and its handle is useless from then on.

All hash objects should be destroyed with the CryptDestroyHash function when the application is finished with them.

BOOL CRYPTFUNC CryptDestroyHash ( 
HCRYPTHASH hHash);

Parameters

  • hHash
    [in] Handle to the hash object to be destroyed.

Return Values

TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. Common values for GetLastError are described in the following table. The error values prefaced by "NTE" are generated by the particular CSP you are using.

Value Description
ERROR_BUSY The hash object specified by hHash is currently being used by another process.
ERROR_INVALID_HANDLE The hHash parameter specifies an invalid handle.
ERROR_INVALID_PARAMETER The hHash parameter contains an invalid value.
NTE_BAD_ALGID The hHash handle specifies an algorithm that this CSP does not support.
NTE_BAD_HASH The hash object specified by the hHash parameter is invalid.
NTE_BAD_UID The CSP context that was specified when the hash object was created cannot be found.

Remarks

When a hash object is destroyed, many CSPs will scrub the memory in the CSP where the hash object was held. The CSP memory is then freed.

There should be a one-to-one correspondence between calls to CryptCreateHash and CryptDestroyHash.

Example

See CryptHashSessionKey.

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 2.10 and later Wincrypt.h   Cryptapi.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CryptCreateHash, CryptHashData, CryptSignHash

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.