The CryptHashData function is used to compute the cryptographic hash on a stream of data. 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 CRYPTFUNC CryptHashData(
HCRYPTHASH hHash, | |
BYTE *pbData, | |
DWORD dwDataLen, | |
DWORD dwFlags | |
); |
When this flag is set, the CSP will prompt the user to input some data directly. This is then added to the hash. The application is not allowed access to the data. For example, this flag can be used to allow the user to enter a PIN into the system.
The Microsoft RSA Base Provider ignores this parameter.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To retrieve extended error information, use the GetLastError function.
The following table lists the error codes most commonly returned by the GetLastError function. The error codes prefaced by “NTE” are generated by the particular CSP you are using.
Error |
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 operating 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. |
See the “Example” section in the CryptSignHash function.
CryptCreateHash, CryptHashSessionKey, CryptSignHash
file: /Techref/os/win/api/win32/func/src/f12_11.htm, 6KB, , updated: 2000/4/7 12:19, local time: 2024/8/16 16:25,
3.145.93.173:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/TECHREF/os/win/api/win32/func/src/f12_11.htm"> CryptHashData Release 2]</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.