Sample code for 30+ languages & platforms
PowerBuilder

Compute Glacier SHA256 Linear Hash of a File

See more Amazon Glacier Examples

Computes the Amazon Glacier SHA256 linear hash for a file.

Chilkat PowerBuilder Downloads

PowerBuilder
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
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