diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-14 17:50:15 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-14 17:50:15 +0000 |
commit | c95efb840d744ec332edfe311b69f1c7ac56560a (patch) | |
tree | 38be8d8b82deaa5b35de0dba5261b442ccd656e8 /plugins/HistoryPlusPlus/Checksum.pas | |
parent | d30ebf7e3b54d8a5887c0f6c2382987f8ad80420 (diff) |
built-in base64 removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@5689 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/HistoryPlusPlus/Checksum.pas')
-rw-r--r-- | plugins/HistoryPlusPlus/Checksum.pas | 34 |
1 files changed, 11 insertions, 23 deletions
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));
|