Sample code for 30+ languages & platforms
Delphi DLL Requires Chilkat v11.0.0+

Workaround for the deprecated Crypt2.HashFile method

Shows how to replace the deprecated HashFile method. (Chilkat is moving away from the use of CkByteData.)

Chilkat Delphi DLL Downloads

Delphi DLL
var
crypt: HCkCrypt2;
path: PWideChar;
outData: HCkByteData;
hex_hash: PWideChar;

begin
crypt := CkCrypt2_Create();

CkCrypt2_putHashAlgorithm(crypt,'sha256');

path := 'c:/someDir/example.dat';

//  ------------------------------------------------------------------------
//  The HashFile method is deprecated:

outData := CkByteData_Create();
success := CkCrypt2_HashFile(crypt,path,outData);

//  ------------------------------------------------------------------------
//  Workaround.
//  (Chilkat is moving away from using CkByteData)

CkCrypt2_putEncodingMode(crypt,'hex_lower');
hex_hash := CkCrypt2__hashFileENC(crypt,path);

CkCrypt2_Dispose(crypt);
CkByteData_Dispose(outData);