Sample code for 30+ languages & platforms
Tcl

Transition from RandomizeKey to GenRandomBytesENC

Provides instructions for replacing deprecated RandomizeKey method calls with GenRandomBytesENC.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set crypt [new_CkCrypt2]

CkCrypt2_put_CryptAlgorithm $crypt "aes"
CkCrypt2_put_CipherMode $crypt "cbc"
CkCrypt2_put_KeyLength $crypt 256
# ...

# ------------------------------------------------------------------------
# The RandomizeKey method is deprecated:

# Generates and sets a random 32-byte (256-bit) secret key.
CkCrypt2_RandomizeKey $crypt

# ------------------------------------------------------------------------
# Do the equivalent using GenRandomBytesENC followed by SetEncodedKey

CkCrypt2_put_EncodingMode $crypt "base64"
set randomKeyBase64 [CkCrypt2_genRandomBytesENC $crypt 32]
CkCrypt2_SetEncodedKey $crypt $randomKeyBase64 "base64"

delete_CkCrypt2 $crypt