CPHashData function
The CPHashData function feeds data into a specified hash object.
Syntax
BOOL CPHashData( __in HCRYPTPROV hProv, __in HCRYPTHASH hHash, __in const BYTE *pbData, __in DWORD dwDataLen, __in DWORD dwFlags );
Parameters
- hProv [in]
-
A handle to a particular key container within the cryptographic service provider (CSP). This handle is obtained by a call to CPAcquireContext.
- hHash [in]
-
A handle to a hash object. An application obtains this handle by using the CryptCreateHash function.
- pbData [in]
-
Address of a buffer that contains the data to be hashed.
- dwDataLen [in]
-
Number of bytes of data to be hashed. If dwFlags is set to CRYPT_USERDATA, this must be zero.
- dwFlags [in]
-
The following value is currently defined.
Return value
If the function succeeds, the function returns TRUE.
If the function fails, it returns FALSE, and the appropriate error code from the following table must be set using SetLastError.
| Return code | Description |
|---|---|
|
The hHash handle specifies an algorithm that this CSP does not support. |
|
The dwFlags parameter contains a value that is not valid. |
|
The hash object specified by the hHash parameter is not valid. |
|
An attempt was made to add data to a hash object that is already marked as "finished." |
|
A keyed hash algorithm is being used, but the session key is no longer valid. This error will be generated if the session key is destroyed before the hashing operating is complete. |
|
The CRYPT_USERDATA flag is set, and the dwDataLen parameter has a nonzero value. |
|
The CSP context that was specified when the hash object was created cannot now be found. |
|
The function failed in some unexpected way. |
|
The CSP ran out of memory during the operation. |
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
See also
Send comments about this topic to Microsoft
Build date: 9/7/2011