This documentation is archived and is not being maintained.

GetHashFromFile Function

Generates a hash over the contents of the specified file.

HRESULT GetHashFromFile (
      [in]  LPCSTR   szFilePath,
      [in, out] unsigned int   *piHashAlg, 
      [out] BYTE     *pbHash,    
      [in]  DWORD    cchHash,    
      [out] DWORD    *pchHash



[in] The name of the file to hash.


[in, out] The algorithm to use when generating the hash. Valid algorithms are those defined by the Win32 CryptoAPI. If piHashAlg is set to 0, the default algorithm CALG_SHA-1 is used.


[out] A byte array containing the generated hash.


[in] The maximum size of the buffer that pbHash points to.


[out] The size, in bytes, of the returned pbHash.

This function is the same as GetHashFromFileW Function, except that the file name specification is ANSI instead of Unicode.

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: StrongName.h

Library: Included as a resource in MsCorEE.dll

.NET Framework Version: 2.0, 1.1, 1.0