Sample code for 30+ languages & platforms
Tcl

Workaround for the deprecated Crypt2.HashBytes method

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

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set crypt [new_CkCrypt2]

CkCrypt2_put_HashAlgorithm $crypt "sha256"

set path "c:/someDir/example.dat"

# ------------------------------------------------------------------------
# The HashBytes method is deprecated:

set inData [new_CkByteData]

CkByteData_loadFile $inData $path

set outData [new_CkByteData]

set success [CkCrypt2_HashBytes $crypt $inData $outData]

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

set bdIn [new_CkBinData]

CkBinData_LoadFile $bdIn $path

CkCrypt2_put_EncodingMode $crypt "base64"
set base64_hash [CkCrypt2_hashBdENC $crypt $bdIn]

delete_CkCrypt2 $crypt
delete_CkByteData $inData
delete_CkByteData $outData
delete_CkBinData $bdIn