sha1

sha1

uses
IdHashSHA, IdGlobal;

function SHA1(Input: string): string;
var sha1: TIdHashSHA1;
begin
  sha1 := TIdHashSHA1.Create;
  try
    Result := LowerCase(sha1.HashBytesAsHex(TidBytes(Bytesof(Input))));
  finally
    sha1.Free;
  end;
end;

procedure TForm2.Button1Click(Sender: TObject);
begin
  var s: String := '咏南中间件';
  Memo1.Text := UpperCase(SHA1(s));   //1BCF1857425600BB9FA8BE390E129715F36A9160
end;

  

posted @ 2021-01-06 13:09  delphi中间件  阅读(678)  评论(0编辑  收藏  举报