C++
C++
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 C++ Downloads
#include <CkCrypt2.h>
#include <CkByteData.h>
void ChilkatSample(void)
{
CkCrypt2 crypt;
crypt.put_HashAlgorithm("sha256");
const char *path = "c:/someDir/example.dat";
// ------------------------------------------------------------------------
// The HashFile method is deprecated:
CkByteData outData;
success = crypt.HashFile(path,outData);
// ------------------------------------------------------------------------
// Workaround.
// (Chilkat is moving away from using CkByteData)
crypt.put_EncodingMode("hex_lower");
const char *hex_hash = crypt.hashFileENC(path);
}