BCryptHash function (bcrypt.h)
Performs a single hash computation. This is a convenience function that wraps calls to BCryptCreateHash, BCryptHashData, BCryptFinishHash, and BCryptDestroyHash.
Syntax
NTSTATUS BCryptHash(
BCRYPT_ALG_HANDLE hAlgorithm,
PUCHAR pbSecret,
ULONG cbSecret,
PUCHAR pbInput,
ULONG cbInput,
PUCHAR pbOutput,
ULONG cbOutput
);
Parameters
hAlgorithm
The handle of an algorithm provider created by using the BCryptOpenAlgorithmProvider function. The algorithm that was specified when the provider was created must support the hash interface.
pbSecret
A pointer to a buffer that contains the key to use for the hash or MAC. The cbSecret parameter contains the size of this buffer. This key only applies to hash algorithms opened by the BCryptOpenAlgorithmProvider function by using the BCRYPT_ALG_HANDLE_HMAC flag. Otherwise, set this parameter to NULL
cbSecret
The size, in bytes, of the pbSecret buffer. If no key is used, set this parameter to zero.
pbInput
A pointer to a buffer that contains the data to process. The cbInput parameter contains the number of bytes in this buffer. This function does not modify the contents of this buffer.
cbInput
The number of bytes in the pbInput buffer.
pbOutput
A pointer to a buffer that receives the hash or MAC value. The cbOutput parameter contains the size of this buffer.
cbOutput
The size, in bytes, of the pbOutput buffer. This size must exactly match the size of the hash or MAC value.
The size can be obtained by calling the BCryptGetProperty function to get the BCRYPT_HASH_LENGTH property. This will provide the size of the hash or MAC value for the specified algorithm.
Return value
A status code indicating success or failure.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 10 [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2016 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | bcrypt.h |
Library | Bcrypt.lib |
DLL | Bcrypt.dll |