Encode and Decode a memory block or string into Email data MiMe (Base64) and UUE formats.
uustring$ = MemToUU (addr%, len%)
len% = UUToMem(uustring$, addr%)
uustring$ = UUEncode(string$)
string$ = UUDecode(uustring$)
mimestring$ = MemToMiMe (addr%, len%)
len% = MiMeToMem(mimestring$, addr%)
mimestring$ = MiMeEncode(string$)
string$ = MiMeDecode(mimestring$)
codedstring$ = _MiMeEncode(string$)
string$ = _MiMeDecode(codedstring$)
addr%, len% | : Memory block address and length |
codedstring$ | : Encoded string (format unknown) |
mimestring$ | : MIME-encoded (Base64) string |
string$ | : UTF-8 string |
uustring$ | : UUE-encoded string |
All the above functions convert either memory blocks or GFABASIC strings into an encoded format and then convert them back to their original form.
UUE (Unix-to-Unix Encoding) was developed in 1980 while MIME (Multipurpose Internet Mail Extensions) was first developed in 1987 and has been built on since then; both are binary-to-text encoding formats and are used in the transmission of data, the former from computer to computer then early email data, the second predominately for email data. The MIME format supported by GFABASIC32 is padded Base64 (to make it 'unpadded', simply remove all trailing '=' characters from the end of the encoded string).
GFABASIC32 provides two methods of encoding and decoding, direct from a memory block and from a GFABASIC32 string:
_MiMeEncode and _MiMeDecode are odd functions as they do not have corresponding Memory block functions and they do not convert into a recognised format; whereas MIME Base64 concatenates the data to be encoded, splits it into 24-bit blocks and then further splits those into 6-bit blocks from left to right, the _MiMeEncode function splits the 24-bit blocks into 6-bit blocks working from right to left. The functions may well have been erroneous and replaced by MiMeEncode and MiMeDecode but not removed; however, more likely, they are a custom implementation to allow communication between enabled programs which, being non-standard, is harder to decipher (however, see next remark).
NOTE: UUE and MIME are encodings NOT cyphers and should not be used for the latter as they are well known and easy to reverse engineer; data encoded with _MiMeEncode would be harder to crack but not much - however, used in combination with another encoder or cypher, it would increase the security exponentially as it is a customised implementation (if indeed it is). That said, there are many far more secure cyphers available which it would be more advisable to use instead.
{Created by James Gaite; Last updated: 26/07/2020 by James Gaite}