summaryrefslogtreecommitdiff
path: root/lowlevelunit.pas
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2015-10-19 15:49:21 +0200
committerErich Eckner <git@eckner.net>2015-10-19 15:49:21 +0200
commit5165427fa759a3b1bbe48ab80edca126425648ac (patch)
treea93107b48b33fbf96b8410a37ec79e63298af675 /lowlevelunit.pas
parent836390ac7e1c790d58490983f68ac3ea6857deca (diff)
downloadunits-5165427fa759a3b1bbe48ab80edca126425648ac.tar.xz
base64Decode neu lowlevelunit.pas
Diffstat (limited to 'lowlevelunit.pas')
-rw-r--r--lowlevelunit.pas16
1 files changed, 16 insertions, 0 deletions
diff --git a/lowlevelunit.pas b/lowlevelunit.pas
index 7543006..3e1911f 100644
--- a/lowlevelunit.pas
+++ b/lowlevelunit.pas
@@ -80,6 +80,7 @@ procedure fehler(s: string);
function hexDump(p: pointer; cnt: longint): string;
function base64ToBin(var s: string): boolean;
+function base64Decode(const s: string; out i: int64): boolean;
var
base64Chars: array[0..63] of char;
@@ -681,6 +682,21 @@ begin
result:=true;
end;
+function base64Decode(const s: string; out i: int64): boolean;
+var
+ j: longint;
+ b: byte;
+begin
+ i:=0;
+ result:=false;
+ for j:=1 to length(s) do begin
+ b:=base64CharsInvers[s[j]];
+ if b=255 then exit;
+ i:=(i shl 6) or b;
+ end;
+ result:=true;
+end;
+
var b: byte;
begin