Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
74
Task/Base64-decode-data/Action-/base64-decode-data.action
Normal file
74
Task/Base64-decode-data/Action-/base64-decode-data.action
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
BYTE FUNC FindIndex(BYTE b)
|
||||
IF b>='A AND b<='Z THEN
|
||||
RETURN (b-'A)
|
||||
ELSEIF b>='a AND b<='z THEN
|
||||
RETURN (b-'a+26)
|
||||
ELSEIF b>='0 AND b<='9 THEN
|
||||
RETURN (b-'0+52)
|
||||
ELSEIF b='+ THEN
|
||||
RETURN (62)
|
||||
ELSEIF b='/ THEN
|
||||
RETURN (63)
|
||||
FI
|
||||
RETURN (-1)
|
||||
|
||||
PROC PrintChar(CHAR c)
|
||||
IF c=10 THEN
|
||||
PutE()
|
||||
ELSE
|
||||
Put(c)
|
||||
FI
|
||||
RETURN
|
||||
|
||||
PROC Decode(CHAR ARRAY s)
|
||||
BYTE i,b1,b2,b3,b4,i1,i2,i3,i4
|
||||
CHAR c
|
||||
|
||||
IF s(0) MOD 4#0 THEN
|
||||
PrintE("Invalid length of string!!!")
|
||||
Break()
|
||||
FI
|
||||
|
||||
i=1
|
||||
WHILE i<=s(0)
|
||||
DO
|
||||
b1=s(i) i==+1
|
||||
b2=s(i) i==+1
|
||||
b3=s(i) i==+1
|
||||
b4=s(i) i==+1
|
||||
|
||||
i1=FindIndex(b1)
|
||||
i2=FindIndex(b2)
|
||||
|
||||
c=i1 LSH 2
|
||||
c==%i2 RSH 4
|
||||
PrintChar(c)
|
||||
|
||||
IF b3#'= THEN
|
||||
i3=FindIndex(b3)
|
||||
c=(i2&$0F) LSH 4
|
||||
c==%i3 RSH 2
|
||||
PrintChar(c)
|
||||
|
||||
IF b4#'= THEN
|
||||
i4=FindIndex(b4)
|
||||
c=(i3&$03) LSH 6
|
||||
c==%i4
|
||||
PrintChar(c)
|
||||
FI
|
||||
FI
|
||||
OD
|
||||
RETURN
|
||||
|
||||
PROC Test(CHAR ARRAY s)
|
||||
PrintE("Encoded:")
|
||||
PrintE(s)
|
||||
PutE()
|
||||
PrintE("Decoded:")
|
||||
Decode(s)
|
||||
PutE()
|
||||
RETURN
|
||||
|
||||
PROC Main()
|
||||
Test("VG8gZXJyIGlzIGh1bWFuLCBidXQgdG8gcmVhbGx5IGZvdWwgdGhpbmdzIHVwIHlvdSBuZWVkIGEgY29tcHV0ZXIuCiAgICAtLVBhdWwgUi5FaHJsaWNo")
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue