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 根据扩展名的文件搜索

Delphi中读写txt文件的一段代码

Delphi如何简单取得后缀名

Delphi 关闭xp保护 替换explorer.exe

Delphi xe10 android 界面设计-个人心得

Delphi cookie获取及使用

Delphi里面控制edit只能输入数字

Delphi 打开文件夹并定位到一个文件

Delphi 批量生成 a到z 字母

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



打赏

取消

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

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

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

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

评论

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