uses IdHashMessageDigest;
...
var
sFile : string;
pSHA : TIdHashSHA1;
pStream : TFileStream;
begin
sFile := 'c:\_ax\error.png';
pSHA := TIdHashSHA1.Create;
pStream := TFileStream.Create( sFile, fmOpenRead or fmShareDenyWrite );
try
ShowMessage( 'File fingerprint = ' + pSHA.HashStreamAsHex( pStream ) );
finally
pStream.Free;
pSHA.Free;
end;
Output: Microsoft AX 2012, X++, C#, SQL server, SSRS, Java, JavaFX, Oracle, PL/SQL, Delphi - codes examples, step-by-step tutorials, experiences.
Tuesday, March 20, 2018
DELPHI - How get hash value for file (SHA-1 fingerprint)
Hash function returns same value for same (in this case) file. This uses SHA-1 (Secure Hash Algorithm) algorithm.
Subscribe to:
Post Comments (Atom)
Unfortunately it calculates incorrect.
ReplyDelete