Addition of base64 module and prog

git-svn-id: https://spexeah.com:8443/svn/Asuro@975 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
goose
2020-07-11 18:51:52 +00:00
parent b9666fb196
commit 8b3d59918d
4 changed files with 273 additions and 1 deletions
File diff suppressed because it is too large Load Diff
+7
View File
@@ -1,3 +1,10 @@
{
Include->MD5 - MD5 checksum.
@author(Angus C <[email protected]>)
@author(Kieron Morris <[email protected]>)
}
unit md5;
interface
+5 -1
View File
@@ -46,7 +46,10 @@ uses
edit,
udpcat,
cpu,
md5, md5sum,
md5,
md5sum,
base64,
base64_prog,
rand;
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
@@ -227,6 +230,7 @@ begin
edit.init();
udpcat.init();
md5sum.init();
base64_prog.init();
terminal.run();
{ Init Splash }
+66
View File
@@ -0,0 +1,66 @@
{
Prog->Base64 - Base64 encode and decode.
@author(Angus C <[email protected]>)
}
unit base64_prog;
interface
uses
console, terminal, keyboard, util, strings, tracer, base64, lmemorymanager;
procedure init();
implementation
procedure run(Params : PParamList);
var
input : pchar;
pinput : pchar;
encdec : pchar;
result : pchar;
i : uInt32;
PSize : uInt32;
begin
tracer.push_trace('base64_prog.run');
if paramCount(Params) > 1 then begin
encdec := getParam(0, Params);
if stringEquals(encdec, 'encode') then begin
PSize := 0;
for i := 1 to ParamCount(params) - 1 do begin
PSize := PSize + stringSize(getParam(i, Params));
end;
Psize := PSize + 1 + (ParamCount(params) - 1);
input := pchar(kalloc(PSize));
pinput := input;
for i := 1 to ParamCount(params) - 1 do begin
memcpy(uInt32(getParam(i, Params)), uInt32(pinput), stringSize(getParam(i, Params)));
inc(pinput, stringSize(getParam(i, Params)));
pinput^ := ' ';
inc(pinput);
end;
dec(pinput);
pinput^ := #0;
result := b64_encode_str(input);
writestringlnWND(result, getTerminalHWND);
kfree(void(result));
end else if stringEquals(encdec, 'decode') then begin
input := getParam(1, Params);
result := b64_decode_str(input);
writestringlnWND(result, getTerminalHWND);
kfree(void(result));
end else writestringlnWND('Usage: base64 <encode/decode> <text>', getTerminalHWND);
end else begin
writestringlnWND('Usage: base64 <encode/decode> <text>', getTerminalHWND);
end;
end;
procedure init();
begin
tracer.push_trace('base64_prog.init');
terminal.registerCommand('BASE64', @Run, 'Perform Base64 Encode/Decode.');
end;
end.