Sample code for 30+ languages & platforms
Tcl

Example: Crypt2.HashStringENC method

Demonstrates how to call the HashStringENC method.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set crypt [new_CkCrypt2]

set s "får"

# The string "får" in utf-8 is composed of these bytes: 0x66 0xC3 0xA5 0x72
CkCrypt2_put_Charset $crypt "utf-8"

CkCrypt2_put_EncodingMode $crypt "hex_lower"
CkCrypt2_put_HashAlgorithm $crypt "sha256"

# Get the hex string for the sha-256 hash of the utf-8 byte representation of the string
set hashStr [CkCrypt2_hashStringENC $crypt $s]

puts "$hashStr"

# Output:
# cb8f773dd592337ed7f928012a60f48e1efb357beeda124a54461410e216fece

delete_CkCrypt2 $crypt