Tcl
Tcl
Generate Salt in Hex or Base64 Format
See more Encryption Examples
Demonstrates how to generate a cryptographic salt value and get the result as hex or base64.Chilkat Tcl Downloads
load ./chilkat.dll
# In cryptography, a salt is random data that is used as an additional input to a one-way function that "hashes" data, a password or passphrase.
# Let's say we want to generate a 16-byte salt value..
set prng [new_CkPrng]
set saltHex [CkPrng_genRandom $prng 16 "hex"]
puts "16-byte salt as hex: $saltHex"
set saltBase64 [CkPrng_genRandom $prng 16 "base64"]
puts "16-byte salt as base64: $saltBase64"
delete_CkPrng $prng