Hashing a file (Delphi example)
In This Topic
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; |