Table 20.17 lists the hashing functions. Hashing can be used for verifying both that received data is from an authentic source, and that it hasn’t been tampered with. The odds of two different chunks of data randomly happening to have the same hash value is so small as to be almost impossible.
The CryptHashSessionKey and CryptHashData functions are useful for creating hashes of keys or data, respectively. CryptSignHash and CryptVerifySignature can be used on either end to add a signature to the hash, or to verify that a signature “squares” with a hash value.
Table 20.17: Hashing Functions
Function | Description |
CryptCreateHash | Creates an empty hash object. |
CryptDestroyHash | Destroys a hash object. |
CryptGetHashParam | Retrieves a parameter from a hash object. |
CryptHashData | Hashes a block of data and includes the result in a specified hash object. |
CryptHashSessionKey | Hashes a session key and includes the result in a specified hash object. |
CryptSetHashParam | Sets a parameter of a given hash object. |
CryptSignHash | Signs the specified hash object. |
CryptVerifySignature | Verifies the digital signature from a signed hash object. |