文件名称:delphi MD5函数
文件大小:11KB
文件格式:PAS
更新时间:2019-03-04 16:17:43
MD5
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} function GetMD5(Buffer: Pointer; BufSize: Integer): string; var I : Integer; MD5Digest : TMD5Digest; MD5Context : TMD5Context; begin for I := 0 to 15 do Byte(MD5Digest[I]) := I + 1; MD5Init(MD5Context); MD5UpdateBuffer(MD5Context, Buffer, BufSize); MD5Final(MD5Digest, MD5Context); Result := ''; for I := 0 to 15 do Result := Result + IntToHex(Byte(MD5Digest[I]), 2); end; {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} function StrMD5(Buffer : String): string; begin Result := GetMD5(@Buffer[1], Length(Buffer)); end;