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 xe安装2010版控件

Delphi 时间耗时统计

Delphi vclskin 5.40在2010安装方法

Delphi firedac 获取mysql 数据库databases 列表

Delphi stringgrid 实例2:1、获取 stringgrid 的行数、列数; 2、给单元赋值

Delphi 获取外部程序句柄与发送消息

Delphi 操作前,删除前,覆盖前,询问对话框

Delphi 相对路径和绝对路径的转换

Delphi为你的窗体有效地提供剪贴板的相关操作

Delphi idhttp解决获取utf-8网页中文乱码问题

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



打赏

取消

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

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

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

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

评论

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