Sample code for 30+ languages & platforms
PowerBuilder Requires Chilkat v11.6.0+

Compute Glacier SHA-256 Linear Hash

See more Amazon Glacier Examples

For existing Amazon Glacier vault customers. The standalone vault service is closed to new customers. These examples use its REST API version 2012-06-01, not the S3 bucket APIs used by S3 Glacier storage classes. See AWS service guidance.

Computes ordinary SHA-256 over the exact file bytes, used as the SigV4 payload hash. This differs from the Glacier tree hash for files larger than 1 MiB. Keep the file unchanged between hashing and uploading.

AWS reference

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Crypt
string ls_HashHex

//  Assumes Chilkat is unlocked. See Global Unlock Sample.
loo_Crypt = create oleobject
li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2")
if li_rc < 0 then
    destroy loo_Crypt
    MessageBox("Error","Connecting to COM object failed")
    return
end if
loo_Crypt.HashAlgorithm = "sha256"
loo_Crypt.EncodingMode = "hexlower"
ls_HashHex = loo_Crypt.HashFileENC("qa_data/jpg/penguins.jpg")
if loo_Crypt.LastMethodSuccess <> 1 then
    Write-Debug "Hashing failed; check that the file exists and is readable."
    destroy loo_Crypt
    return
end if

Write-Debug ls_HashHex


destroy loo_Crypt