MD5 SHA1 SHA2 可以引用System.Hash单元
procedure TForm4.Button1Click(Sender: TObject); var md5: THashMD5; begin Edit2.Text := md5.GetHashString(Edit1.Text); //生成32字符长度的MD5 Edit3.Text := md5.GetHMAC(Edit1.Text, 'jack'); //生成32字符长度的HMAC. end; procedure TForm4.Button2Click(Sender: TObject); var sha1:THashSHA1; begin Edit2.Text := sha1.GetHashString(Edit1.Text); //生成32字符长度的MD5 Edit3.Text := sha1.GetHMAC(Edit1.Text, 'jack'); //生成32字符长度的HMAC. end;