CryptHashData

This function is used by applications to feed data to a specified hash object. This function and CryptHashSessionKey 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 get a handle to a hash object.

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

Parameters

  • hHash
    [in] Handle to the hash object. An application obtains this handle by using the CryptCreateHash function.
  • pbData
    [in] Pointer to the data to be hashed.
  • dwDataLen
    [in] Specifies the number of bytes of data to be hashed. This must be zero if the CRYPT_USERDATA flag is set.
  • dwFlags
    [in] Specifies a bitmask of flags.

Return Values

TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. Common values for GetLastError are described in the following table. The error values prefaced by "NTE" are generated by the particular CSP you are using.

Value Description
ERROR_INVALID_HANDLE One of the parameters specifies an invalid handle.
ERROR_INVALID_PARAMETER One of the parameters contains an invalid value. This is most often an illegal pointer.
NTE_BAD_ALGID The hHash handle specifies an algorithm that this CSP does not support.
NTE_BAD_FLAGS The dwFlags parameter contains an invalid value.
NTE_BAD_HASH The hash object specified by the hHash parameter is invalid.
NTE_BAD_HASH_STATE An attempt was made to add data to a hash object that is already marked "finished."
NTE_BAD_KEY 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 operation is complete.
NTE_BAD_LEN The CRYPT_USERDATA flag is set and the dwDataLen parameter has a nonzero value.
NTE_BAD_UID The CSP context that was specified when the hash object was created cannot be found.
NTE_FAIL The function failed in some unexpected way.
NTE_NO_MEMORY The CSP ran out of memory during the operation.

Example

See CryptGetHashParam.

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 2.10 and later Wincrypt.h   Cryptapi.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CryptCreateHash, CryptHashSessionKey, CryptSignHash

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.