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

uses XceedEncryptionLib_TLB 

var
  xHash : TXceedHashing; 
  xSHA : DXceedSHAHashingMethod; 
  vaBytesRead : OleVariant; 
  vaHashValue : OleVariant; 
begin
  xHash := TXceedHashing.Create( self ); 
  xHash.License( 'your license key' ); 

  xSHA := CoXceedSHAHashingMethod.Create();  

try 
  xSHA.HashSize := 256; 
  xHash.HashingMethod := xSHA;  

  vaBytesRead := xHash.ReadFile( 'c:\temp\source.txt', 0, 0, efpHash, true );  

  vaHashValue := xSHA.HashValue; 

  { Do something with the HashValue... }  

  ShowMessage( 'Hashing successful!' ); 
except 
  on xErr : Exception do 
    ShowMessage( xErr.Message ); 
end;  

xHash.Free; 

end;