Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CryptHashData (Windows CE 5.0)

Windows CE 5.0
Send Feedback

This function adds data to a specified hash object. This function and the CryptHashSessionKey function can be called multiple times to compute the hash on long streams or on discontinuous streams.

Before calling this function, the CryptCreateHash function must be called to create a handle to a hash object.

BOOL WINAPI CryptHashData( 
  HCRYPTHASH hHash, 
  BYTE* pbData,
  DWORD dwDataLen, 
  DWORD dwFlags
);

Parameters

hHash
[in] HCRYPTHASH handle to the hash object created by calling the CryptCreateHash function.
pbData
[in] Pointer to a buffer containing the data to be hashed.
dwDataLen
[in] Specifies the number of bytes of data to be hashed. This value must be zero if the CRYPT_USERDATA flag is set.
dwFlags
[in] Bitmask of flags. All Microsoft cryptographic service providers ignore this parameter. The CRYPT_USERDATA flag value is defined for other cryptographic service providers (CSPs).

If the CRYPT_USERDATA flag is set, the CSP prompts the user to input data directly and adds the data to the hash. Access directly to the hash data is not allowed; instead, applications manipulate the hash values through the hash handle. This flag allows the users to enter a personal identification number (PIN) into the system.

Return Values

TRUE indicates success. FALSE indicates failure. To get extended error information, call the GetLastError function.

The following table shows the common values for the GetLastError function. The error values prefaced by NTE are generated by the particular CSP you are using.

ValueDescription
ERROR_INVALID_HANDLEOne of the parameters specifies an invalid handle.
ERROR_INVALID_PARAMETEROne of the parameters contains an invalid value. This is most often an illegal pointer.
NTE_BAD_ALGIDThe hHash handle specifies an algorithm that this CSP does not support.
NTE_BAD_FLAGSThe dwFlags parameter contains an invalid value.
NTE_BAD_HASHThe hash object specified by the hHash parameter is invalid.
NTE_BAD_HASH_STATEAn attempt was made to add data to a hash object that is already marked as finished.
NTE_BAD_KEYA 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 operation is complete.
NTE_BAD_LENThe CRYPT_USERDATA flag is set and the dwDataLen parameter has a nonzero value.
NTE_BAD_UIDThe CSP context that was specified when the hash object was created cannot be found.
NTE_FAILThe function failed in some unexpected way.
NTE_NO_MEMORYThe CSP ran out of memory during the operation.

Example Code

See CryptGetHashParam.

Requirements

OS Versions: Windows CE 2.10 and later.
Header: Wincrypt.h.
Link Library: Coredll.lib.

See Also

CryptCreateHash | CryptHashSessionKey | CryptSignHash


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.