home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 31
/
CDASC_31_1996_juillet_aout.iso
/
internet
/
base64_2.zip
/
BASE64.DOC
next >
Wrap
Text File
|
1996-06-09
|
9KB
|
217 lines
Documentation for the Base 64 Encoder:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contents:
---------
1. General information regarding the programs
2. About ENCODE64.EXE
3. About DECODE64.EXE
4. Technical information regarding BASE 64 encoding
5. Disclaimer, distribution, etc.
6. Revision Notes
1. General:
~~~~~~~~~~~
These DOS programs have built-in error checking to make sure the files
are processed correctly. However, if there are unexplained errors while
processing, the program will give a "Runtime Error" message. Check in
this documentation for information regarding possible errors. Most errors
will likely be caused by the DECODE64 program, because of text-processing
problems. If all else fails, refer to the section on DECODE64 and see
how the program works! If you think a certain problem may be a bug in
the program, please e-mail me. My e-mail address is at the bottom of
this document.
NOTE: DECODE64 will only decode files with a CR/LF at the end of every
line. It will not decode a file with only LF. This program was made for
DOS, so if you need to decode a file with only LF (ASCII 10) at the end
of every line, it will need to be converted to DOS CR/LF first (having
an ASCII 13 & ASCII 10 at the end of every line).
IMPORTANT: Internet mail programs will probably not recognize encoded
files over e-mail when encoded using ENCODE64. This is because information
is added to the header and body of sent e-mails when files are included
with them. It is impossible to mimic this with these programs. Whoever
receives a Base64 encoded file encoded using ENCODE64 may need a utility
similar to DECODE64 to be able to decode it.
2. About ENCODE64.EXE:
~~~~~~~~~~~~~~~~~~~~~~
This program takes any file (binary or otherwise) and converts it
into a format transmittable over the Internet. (See technical information
below.) The command line for this program is:
ENCODE64 <filename>
Where <filename> is any file.
Example:
C:\>ENCODE64 PROGRAM.ZIP
After executing this, ENCODE64 will create a file called "PROGRAM.64" in
the current directory. If a file with that name was already found, it will
say so and will not overwrite it (it must be moved or deleted before
ENCODE64 will create the file, just to make sure that no data is lost).
3. About DECODE64.EXE:
~~~~~~~~~~~~~~~~~~~~~~
Command line for this program is:
DECODE64 <filename>
Where <filename> is any BASE-64 encoded file.
This program takes any BASE-64 encoded file and converts it back into
whatever it was before it was encoded. Since some formats of BASE-64
encoding may have different line lengths, etc, these steps are followed
by the program:
1. Search <filename> for the string 'name="' (no single quotes). When
it finds the string, it will take the output filename from between
the quotes and check to see if there is already a file of the same
name in the current directory. If there is, it will prompt you if
you want the file overwritten. If not, it will quit. If the file
was not found, it will create it.
See revision notes at the bottom of this document for another,
optional, file name format (under version 2, revision #3).
2. Make sure the end of the header is found. If the 'name="' was
found before the end of the header, it will read lines until a blank
line is found. This means that the end of the header has been
reached. There *MUST* be a space between the header and the encoded
data. The header is composed of the 'name="' and other data.
3. Read one line. The length of this line will tell how long the BASE-64
lines are formatted for. If any subsequent line is smaller than the
first line, the end of the file has been reached.
4. If any encoded data line's length is not evenly divisible by 4,
the program will abandon processing.
5. If an end of file was reached without a single line being smaller
in length than 4, or with a "-" character being reached, then the
program will give a "Possible unexpected end of file" message.
See revision note at the end of the document under version 2,
revision #5 regarding the dash symbol at the end of encoded data.
The ideal format for the BASE 64 file would be one created by the
ENCODE64 program, or in this format:
--==========================
name="test.zip"
<header stuff>
<header stuff>
AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPP
QQ==
--==========================
Note the blank line between the header and the encoded data, and the
"-" character immediately following the encoded data. This will make
sure the file is created properly.
If there is no blank space between the header and the encoded data,
the program will keep reading until it reaches a blank line, causing
errors.
If the file ends immediately after the encoded data, DECODE64 will give
a false error message ("Possible unexpected end of file"), but will
nevertheless create the file correctly.
About the "Bad Character" error: This error is caused by a character
other than the ones accepted by Base64 being in the encoded data. This
error will not halt the program, but the outputted file may have bad
data in it. If the end of the encoded data was not properly found,
this error could also be caused by DECODE64 attempting to decode
regular text which may appear after the encoded file segment.
Most other errors may be caused by DECODE64 not being able to properly
find the end of the encoded data. For best results, edit the encoded
file so it matches the template shown above.
4. Technical Information:
~~~~~~~~~~~~~~~~~~~~~~~~~
BASE-64 (MIME encoding) converts regular 8-bit encoded files into
a form which can be readily transmittable via Internet e-mail. It
is impossible to send any 8-bit file over e-mail without this or a
similar process done (such as XX-encoding, UU-encoding, etc).
The way it encodes is by taking three (8-bit) bytes from the file,
and converting those 24 bits into 4 sets of 6-bit numbers. Since a
6-bit number can never go over 63, it outputs to the BASE-64 file
with these characters:
Character:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
Value: 0..............................................................63
Since some files will not have sizes evenly divisible by three, padding
is added with the "=" character at the end of the BASE64 file.
BASE-64 is superior to UU encoding & XX encoding in that it does not
use any characters that may *not* be readily transmittable via Internet.
Also, for ever 45 encoded characters of XX & UU, there is one extra
character as a line checksum (seen as the first character of every
line). Data transmission has become so reliable that checksums are
no longer necessary.
For more information on MIME encoding, look up RFC 1521.
5. Disclaimer, Distribution, Etc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DISCLAIMER: I'm not responsible if this messes up your computer in
any way. But how could it? :)
These programs are freeware, and if you like it, e-mail me. If
there are any persistant problems with either of the programs which you
think are bugs, e-mail me. These programs can be distributed freely
as long as ALL files are kept in the same archive. If these programs
are put on a CD-ROM, FTP site, WWW, etc, I'd appreciate knowing it!
Also, none of the programs can be sold.
Thanks to the few people who have e-mailed me and convinced me to
bring out future versions.
These programs were written by Fire Frog in April, 1996.
My e-mail address (as of now) is:
frog@star2.opsys.com
BBS I can be contacted on (as "Fire Frog"):
MANx Cat BBS -- 305-245-0113
(Based in the Miami area)
Sysop: Major Airwaves
6. Revision Updates
~~~~~~~~~~~~~~~~~~~
These notes tell of added features, etc, added to the programs. The
programs themselves don't tell their own version number, but if this
document was included with your archive, then you have the updated
version.
Sorry, no fancy version numbers. Can only make filename eight
characters! :)
#1 -- Basic version.
#2 -- 1. First update.
2. Slightly faster disk access added.
3. Support for using the 'name = <filename>' string instead of
'name="<filename>"' string. (Used by some encoders.)
4. User can now optionally overwrite files: either the ".64"
files created by ENCODE64 or the files created by DECODE64.
5. Support for some encoders, which, instead of having dashes
"-" immediately following encoded data, will have a blank
line and then the dashes. If it finds a blank line anywhere
in encoded data, it will stop processing.
________________________________________________________________________
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~