(Delphi DLL) 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, Crypt2;
...
procedure TForm1.Button1Click(Sender: TObject);
var
crypt: HCkCrypt2;
linearHashHex: PWideChar;
begin
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
crypt := CkCrypt2_Create();
// The "linear hash" is simply the SHA256 hash of the file bytes.
CkCrypt2_putHashAlgorithm(crypt,'sha256');
// Return the hash in lowercase hexidecimal format.
CkCrypt2_putEncodingMode(crypt,'hexlower');
linearHashHex := CkCrypt2__hashFileENC(crypt,'qa_data/jpg/penguins.jpg');
Memo1.Lines.Add('SHA256 linear hash = ' + linearHashHex);
CkCrypt2_Dispose(crypt);
end;
|