(Tcl) Workaround for the deprecated Crypt2.HashBytesENC method
Shows how to replace the deprecated HashBytesENC method. (Chilkat is moving away from the use of CkByteData.) Note: This example requires Chilkat v11.0.0 or greater.
load ./chilkat.dll
set crypt [new_CkCrypt2]
CkCrypt2_put_HashAlgorithm $crypt "sha256"
CkCrypt2_put_EncodingMode $crypt "base64"
set path "c:/someDir/example.dat"
# ------------------------------------------------------------------------
# The HashBytes method is deprecated:
set inData [new_CkByteData]
CkByteData_loadFile $inData $path
set base64_hash [CkCrypt2_hashBytesENC $crypt $inData]
# ------------------------------------------------------------------------
# Workaround.
# (Chilkat is moving away from using CkByteData)
set bdIn [new_CkBinData]
CkBinData_LoadFile $bdIn $path
set base64_hash [CkCrypt2_hashBdENC $crypt $bdIn]
delete_CkCrypt2 $crypt
delete_CkByteData $inData
delete_CkBinData $bdIn
|