The ManagedCryptoAPI class includes a method called ManagedComputeHash, which computes a hash for an array of bytes. To use ManagedComputeHash, follow these steps:
Acquire an instance of the ManagedCryptoAPI class.
Use the ManagedCryptoAPI instance to acquire a handle to a key container within a CSP.
Pass the context handle, the array of bytes for which to compute a hash, and a reference to an Int32 to the ManagedComputeHash method.
ManagedComputeHash returns an array of bytes holding the hash bytes and sets the reference to the Int32 to the number of bytes in the returned array that hold valid hash data.
Listing 14.3, taken from the sample application ComputeHash, demonstrates computing a hash with ManagedCryptoAPI ...