(PowerBuilder) Compute Glacier SHA256 Linear Hash of a File
Computes the Amazon Glacier SHA256 linear hash for a file.
integer li_rc
oleobject loo_Crypt
string ls_LinearHashHex
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Crypt = create oleobject
// Use "Chilkat_9_5_0.Crypt2" for versions of Chilkat < 10.0.0
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
// The "linear hash" is simply the SHA256 hash of the file bytes.
loo_Crypt.HashAlgorithm = "sha256"
// Return the hash in lowercase hexidecimal format.
loo_Crypt.EncodingMode = "hexlower"
ls_LinearHashHex = loo_Crypt.HashFileENC("qa_data/jpg/penguins.jpg")
Write-Debug "SHA256 linear hash = " + ls_LinearHashHex
destroy loo_Crypt
|