Sample code for 30+ languages & platforms
Tcl

Compute Glacier SHA256 Linear Hash of a File

See more Amazon Glacier Examples

Computes the Amazon Glacier SHA256 linear hash for a file.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

set crypt [new_CkCrypt2]

# The "linear hash" is simply the SHA256 hash of the file bytes.
CkCrypt2_put_HashAlgorithm $crypt "sha256"

# Return the hash in lowercase hexidecimal format.
CkCrypt2_put_EncodingMode $crypt "hexlower"

set linearHashHex [CkCrypt2_hashFileENC $crypt "qa_data/jpg/penguins.jpg"]
puts "SHA256 linear hash = $linearHashHex"

delete_CkCrypt2 $crypt