MD5与DES加密算法【Delphi版】

来源:互联网 时间:1970-01-01

MD5加密算法:

      方式一:

var
md5: TMD5Digest;
passwordSource:string;
passwordDestinate:string;
begin
passwordSource:='testStringForMD5';
MD5String(passwordSource, @md5);
passwordDestinate:=MD5DigestToStr(md5);//32位的MD5加密结果
end;

      方式二:

var
MyMD5: TIdHashMessageDigest5;
Digest: T4x4LongWordRecord;
passwordSource:
string;
passwordDestinate:
string;
begin
passwordSource:
='testStringForMD5';
MyMD5 :
= TIdHashMessageDigest5.Create;
Digest :
= MyMD5.HashValue(passwordSource);
passwordDestinate:
=MyMD5.AsHex(Digest);//32位的MD5加密结果
MyMD5.Free;
end;

   说明:以上两种方式都要使用MD5Unit.pas单元

DES加密算法:


相关阅读:
Top