Sample code for 30+ languages & platforms
Tcl

Workaround for the deprecated Crypt2.HashString method

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

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set crypt [new_CkCrypt2]

CkCrypt2_put_Charset $crypt "utf-8"

CkCrypt2_put_HashAlgorithm $crypt "sha256"

set inputStr "This is a test."

# ------------------------------------------------------------------------
# The HashString method is deprecated:

set outData [new_CkByteData]

set success [CkCrypt2_HashString $crypt $inputStr $outData]

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

CkCrypt2_put_EncodingMode $crypt "base64"
set hash_base64 [CkCrypt2_hashStringENC $crypt $inputStr]

puts "$hash_base64"

delete_CkCrypt2 $crypt
delete_CkByteData $outData