Quick way to hash data using WinAPI
Use HashData.
// Usage:// A magical string to get hashed TCHAR szDataToHash[] = _T( "Oobolooblahblah, abracadabra, ooboboblablah, get this string hashed" ); // Determines the size of hash value to be returned. DWORD HashVal = 0; // Hash now HRESULT hRes = HashData( LPBYTE( szDataToHash ), // Data to hash, can be of any type _tcslen( szDataToHash ) * sizeof( TCHAR ), // Byte count of data to hash LPBYTE( &HashVal ), // Hash value sizeof( HashVal )); // Length of hash val // Must return S_OK on success ASSERT( SUCCEEDED( hRes ));Note that this function can in a way be used for computing CRC values, though I am not sure. Sizeof HashVal determines the length of CRC. Also can be used for computing file checksums.
Categories: Windows API
Checksum, Checksum of file data, CRC, File checksum, File CRC, File hash value, Hash, Hash of file data, HashData

