From c95efb840d744ec332edfe311b69f1c7ac56560a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 14 Aug 2013 17:50:15 +0000 Subject: built-in base64 removed git-svn-id: http://svn.miranda-ng.org/main/trunk@5689 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/HistoryPlusPlus/Checksum.pas | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'plugins/HistoryPlusPlus/Checksum.pas') diff --git a/plugins/HistoryPlusPlus/Checksum.pas b/plugins/HistoryPlusPlus/Checksum.pas index 47ab3245c9..777d15af4a 100644 --- a/plugins/HistoryPlusPlus/Checksum.pas +++ b/plugins/HistoryPlusPlus/Checksum.pas @@ -60,7 +60,7 @@ var implementation uses - SysUtils, Base64; + SysUtils, m_api; const DIGEST_DIV = '-'; @@ -71,18 +71,25 @@ const function DigToBase(Digest: TDig64): AnsiString; var DigStr: AnsiString; + EncodedStr: PAnsiChar; begin SetLength(DigStr, SizeOf(Digest)); Move(Digest, DigStr[1], SizeOf(Digest)); - Result := Base64EncodeStr(DigStr); + EncodedStr := mir_base64_encode(PByte(@DigStr[1]), Length(DigStr)); + Result := EncodedStr; + mir_free(EncodedStr); end; function BaseToDig(const Str: AnsiString): TDig64; var DigStr: AnsiString; + BufLen: int; + Buf: PByte; begin - DigStr := Base64DecodeStr(Str); - Move(DigStr[1], Result, SizeOf(Result)); + Buf := mir_base64_decode(PAnsiChar(Str), BufLen); + if (BufLen = SizeOf(Result)) then + Move(Buf^, Result, SizeOf(Result)); + mir_free(Buf); end; function HashString(const Str: AnsiString): TDig64; @@ -90,27 +97,8 @@ begin Result := ZeroDig; Result[0] := InitCRC; CalcCRC32(@Str[1], Length(Str), Result[0]); - // CalcSampleHash(@Str[1],Length(Str),Result); end; -(* -function StrToDig(Str: AnsiString): TDig64; -var - Dig1, Dig2: AnsiString; - n: Integer; -begin - Result[0] := 0; - Result[1] := 0; - n := Pos(DIGEST_DIV, Str); - if n = 0 then - exit; - Dig1 := Copy(Str, 1, n - 1); - Dig2 := Copy(Str, n + 1, Length(Str)); - - Result[0] := StrToInt('$' + Dig1); - Result[1] := StrToInt('$' + Dig2); -end; -*) function DigToStr(Digest: TDig64): AnsiString; begin Result := AnsiString(IntToHex(Digest[0], 8)) + DIGEST_DIV + AnsiString(IntToHex(Digest[1], 8)); -- cgit v1.2.3