Page 1 of 1
Posted: Fri Jan 31, 2003 8:43 pm
by BackupUser
Restored from previous forum. Originally posted by Num3.
Well PB encodes to base64...
And what about decoding a b64 file/string ???
--
Kind Regards
Rui Carvalho
Current PB Projects:
[Construdata 2003 - 30%]
[Step by Step - 50%]
Posted: Fri Jan 31, 2003 9:24 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
To clear things up: this is not my code!
Found this some time ago in the german forum, don't recall who did this.
(Shame on me, forgot to write it down...)
The only change I did, was to change the input data from a pointer to a string - now it's equal to the encoding command in pb.
Code: Select all
Procedure Base64Decoder(b64in$, b64len.l ,*b64out, b64max.l)
*b64in.l = @b64in$ ; 0
If b64num = 65
b64pad +1
EndIf
b64bin$ +Right("000000" + Bin(b64num-1),6) ;24 Bit code
Else
b64err = 1
b64xln = b64tln +1
EndIf
Next b64xb
For b64xu = 0 To 2-b64pad
b64bit$ = Mid(b64bin$,1+b64xu*8,8) + "|"
b64num = FindString(b64asc$,b64bit$,0) /9 ;ASC Code 8 Bit Binary
PokeS(*b64out+b64buf,Chr(b64Num))
b64buf +1
If b64buf >b64max
b64err = 1
b64xln = b64tln +1
EndIf
Next b64xu
Next b64xln
If b64err = 1
RtlFillMemory_(*b64out,b64max,0)
b64buf = -1
EndIf
ProcedureReturn b64buf
EndProcedure
Have a nice day...
Franco
Posted: Sat May 10, 2003 6:49 pm
by TronDoc

=
--jb
b64asc$ = b64asc$ + Right("0000000" + Bin(b64x),8) + "|"
Code: Select all
For b64x = 0 To 255
b64asc$ = b64asc$ + Right("0000000" + Bin(b64x),8) + "|" ;ASC Binary Code
Next b64x
b64bit$ = Mid(b64bin$,1+b64xu*8,8) + "|"
Code: Select all
For b64xu = 0 To 2-b64pad
b64bit$ = Mid(b64bin$,1+b64xu*8,8) + "|"
b64num = FindString(b64asc$,b64bit$,0) /9 ;ASC Code 8 Bit Binary
PokeS(*b64out+b64buf,Chr(b64Num))
b64buf +1
If b64buf >b64max
b64err = 1
b64xln = b64tln +1
EndIf
Next b64xu
Posted: Sat May 10, 2003 8:04 pm
by fsw
Suppose this will not be the last funny transition code we will see...
Franco
Posted: Sat May 10, 2003 10:53 pm
by freak
Is it better like this?
The smileys can be disabled in the posts btw.
Timo
Posted: Mon May 12, 2003 7:22 pm
by TronDoc