2017-02-27 07:43:55 -08:00
|
|
|
{$codepage utf8}
|
|
|
|
{$h+}
|
|
|
|
{$mode objfpc}
|
|
|
|
Unit Hash.Md;
|
2017-02-26 20:34:42 -08:00
|
|
|
|
2017-02-27 07:43:55 -08:00
|
|
|
interface
|
|
|
|
|
|
|
|
Uses
|
|
|
|
md5,
|
|
|
|
SysUtils,
|
|
|
|
Classes;
|
|
|
|
|
|
|
|
Type
|
|
|
|
Md = class(TObject)
|
|
|
|
public
|
|
|
|
function md2(S : UTF8String) : AnsiString;
|
|
|
|
function md4(S : UTF8String) : AnsiString;
|
|
|
|
function md5(S : UTF8STring) : AnsiString;
|
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
function Md.md2(S : UTF8String) : AnsiString;
|
|
|
|
begin
|
|
|
|
Result := MD2Print(MDString(S, MD_VERSION_2));
|
|
|
|
end;
|
|
|
|
|
|
|
|
function Md.md4(S : UTF8String) : AnsiString;
|
|
|
|
begin
|
|
|
|
Result := MD4Print(MDString(S, MD_VERSION_4));
|
|
|
|
end;
|
|
|
|
|
|
|
|
function Md.md5(S : UTF8String) : AnsiString;
|
|
|
|
begin
|
|
|
|
Result := MD5Print(MDString(S, MD_VERSION_5));
|
|
|
|
end;
|
|
|
|
|
|
|
|
End.
|