Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
To help ensure security, we recommend that hash objects be destroyed after they have been used.
BOOL CryptDestroyHash(
[in] HCRYPTHASH hHash
);
[in] hHash
The handle of the hash object to be destroyed.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. For extended error information, call GetLastError.
The error codes prefaced by "NTE" are generated by the particular cryptographic service provider (CSP) you are using. Some possible error codes follow.
Return code | Description |
---|---|
|
The hash object specified by hHash is currently being used and cannot be destroyed. |
|
The hHash parameter specifies a handle that is not valid. |
|
The hHash parameter contains a value that is not valid. |
|
The hHash handle specifies an algorithm that this CSP does not support. |
|
The hash object specified by the hHash parameter is not valid. |
|
The CSP context that was specified when the hash object was created cannot be found. |
When a hash object is destroyed, many CSPs overwrite 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.
All hash objects that have been created by using a specific CSP must be destroyed before that CSP handle is released with the CryptReleaseContext function.
For an example that uses the CryptDestroyHash function, see Example C Program: Creating and Hashing a Session Key.
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | wincrypt.h |
Library | Advapi32.lib |
DLL | Advapi32.dll |
Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register today