Skip to content

TWebSHAHash

TWebSHAHash exposes easy to use cryptographic hash functions, more specifically Secure Hash Algorithms (SHA). The supported SHA algorithms are: SHA-1, SHA-256, SHA-384 and SHA-512.

Below is a list of the most important properties and methods for the TWeSHAHash.

Properties for TWebSHAHash

Property Description
HashType: TCryptoHash Sets the hashing algorithm to use.

Methods for TWebSHAHash

Property Description
Hash(AText: string): TJSPromise The result of the TJSPromise will contain the hashed AText.

Example

procedure TForm1.WebButton1Click(Sender: TObject); async;
var
  sha: TWebSHAHash;
  s: string;
begin
  sha := TWebSHAHash.Create(ehSHA1);
  s := Await(string, sha.Hash('text to be hashed'));
  WebMemo1.Lines.Add(s);
end;