Xceed Encryption Library Documentation
Hashing a file (C# example)
Examples > Hashing a file (C# example)
C# Copy Code

XceedEncryptionLib.XceedHashing hasher = new XceedEncryptionLib.XceedHashingClass();

hasher.License( @"your license key" );      

try
{
  XceedEncryptionLib.XceedSHAHashingMethod sha = new XceedEncryptionLib.XceedSHAHashingMethodClass(); 

  sha.HashSize = 256;

  hasher.HashingMethod = sha; 
  hasher.ReadFile( @"c:\test\file.txt", 0, 0, XceedEncryptionLib.EXEFileProcessing.efpHash, true );

  object hash = sha.HashValue;      
}
catch( System.Runtime.InteropServices.COMException except )
{
  MessageBox.Show( except.ToString() );
}