(Delphi ActiveX) Compute Glacier SHA256 Linear Hash of a File
Computes the Amazon Glacier SHA256 linear hash for a file.
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;
...
procedure TForm1.Button1Click(Sender: TObject);
var
crypt: TChilkatCrypt2;
linearHashHex: WideString;
begin
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
crypt := TChilkatCrypt2.Create(Self);
// The "linear hash" is simply the SHA256 hash of the file bytes.
crypt.HashAlgorithm := 'sha256';
// Return the hash in lowercase hexidecimal format.
crypt.EncodingMode := 'hexlower';
linearHashHex := crypt.HashFileENC('qa_data/jpg/penguins.jpg');
Memo1.Lines.Add('SHA256 linear hash = ' + linearHashHex);
end;
|