The CPCreateHash function is used by applications to initiate the hashing of a stream of data.
BOOL CPCreateHash(
HCRYPTPROV hProv, // in
ALG_ID Algid, // in
HCRYPTKEY hKey, // in
DWORD dwFlags, // in
HCRYPTHASH *phHash // out
);
If the function succeeds, TRUE should be returned; otherwise, return FALSE. When FALSE is returned, the appropriate error code (see the following table) must be set via SetLastError.
Error | Description |
---|---|
NTE_BAD_ALGID | The Algid parameter specifies an algorithm that this CSP does not support. |
NTE_BAD_FLAGS | The dwFlags parameter is non-zero. |
NTE_BAD_KEY | A keyed hash algorithm (for example, CALG_MAC) is specified by Algid, and the hKey parameter is either zero or it specifies an invalid key handle. This error code will also be returned if the key is to a stream cipher, or if the cipher mode is one that doesn't use feedback. |
NTE_NO_MEMORY | The CSP ran out of memory during the operation. |
CPDestroyHash, CPHashData, CryptCreateHash