delphi md5加密字符串


本文整理自网络,侵删。

 unit ToMd5;

interface
uses
IdHashMessageDigest, IdHash, IdGlobal;

type
TMD5 = class(TIdHashMessageDigest5);

function StrToMD5(S: String): String; overload;
function StrToMD516(S: String; L: integer): String; overload; //返加16位MD5值
function StrToMD532(S: String; L: integer): String; overload; //返回32位MD5值

implementation
function StrToMD5(S: String): String;
var
Md5Encode: TMD5;
begin
Md5Encode:= TMD5.Create;
result:= Md5Encode.AsHex(Md5Encode.HashValue(S));
Md5Encode.Free;
end;

function StrToMD516(S: String; L: integer): String;
begin
result:= copy(StrToMD5(S),9,L);
end;

function StrToMD532(S: String; L: integer): String; overload;
begin
result:= copy(StrToMD5(S),1,L);
end;
end.

相关阅读 >>

Delphi 通过读取注册表信息获取桌面路径

Delphi读取webbrowse中的图片显示在image中

Delphi 动态加载删除字体

Delphi 快速读取写入注册表参数值的函数

Delphi检查getelementbyid返回值的有效性

Delphi 2010 fastmm 内存泄露使用方法

Delphi image 等比例缩小

Delphi 取键盘值

Delphi和outputdebugstring

Delphi getfilehashmd5获取文件 hashmd5值

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...