如何使用 Delphi 散列字符串? [英] How do I hash a string with Delphi?

查看:26
本文介绍了如何使用 Delphi 散列字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 Delphi 生成字符串的 MD5 哈希值?

How do I make an MD5 hash of a string with Delphi?

推荐答案

如果您想要 MD5 摘要并拥有 Indy 组件安装,你可以这样做:

If you want an MD5 digest and have the Indy components installed, you can do this:

uses SysUtils, IdGlobal, IdHash, IdHashMessageDigest;

with TIdHashMessageDigest5.Create do
try
    Result := TIdHash128.AsHex(HashValue('Hello, world'));
finally
    Free;
end;

Delphi 加密包支持最流行的算法:

  • 哈弗
  • MD4、MD5
  • RipeMD-128、RipeMD-160
  • SHA-1、SHA-256、SHA-384、SHA-512,
  • 老虎

更新DCPCrypt 现在由 Warren Postma 维护,来源可以在 这里.

Update DCPCrypt is now maintained by Warren Postma and source can be found here.

这篇关于如何使用 Delphi 散列字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆