(Delphi ActiveX) MD4 Hash a String
MD4 hash a string.
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;
content: WideString;
hashStr: WideString;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
crypt := TChilkatCrypt2.Create(Self);
content := 'The quick brown fox jumps over the lazy dog';
// The desired output is a hexidecimal string:
crypt.EncodingMode := 'hex';
// Set the hash algorithm:
crypt.HashAlgorithm := 'md4';
hashStr := crypt.HashStringENC(content);
Memo1.Lines.Add(hashStr);
// The output is:
// 1BEE69A46BA811185C194762ABAEAE9
end;
|