home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
sharewar
/
FFE
/
XX3402.ZIP
/
XX3402.DOC
< prev
next >
Wrap
Text File
|
1994-01-28
|
12KB
|
331 lines
XX34 Version 0.2 01/28/94
Public Domain Binary Encoder/Decoder
by Guy McLoughlin
WHAT THE HEY IS XX34 ?
XX34 is a utility program that encodes binary files into alpha-
numeric ASCII text blocks. Once encoded these text blocks can
be transmitted over text based systems, and then decoded back
into a copy of the original binary file. XX34 makes the entire
process quite simple, especially decoding as no editing or
sorting is required to decode the encoded text blocks.
SYNTAX
If you enter "XX3402" on the DOS command-line with no parameters,
you will see the XX3402 syntax info:
XX3402 Binary Encoder/Decoder Version 0.2 01-28-94
Public-Domain Utility by Guy McLoughlin
Usage: XX3402 <E|ES|D|T> [d:][path]<filename> [cols] [rows] [ADn]
Encode Parameters
<E> Encode binary file (single output file)
<ES> Encode binary file (split output files)
[cols] Min = 60, Max = 100 (default = 72)
[rows] Min = 10, Max = 600 (default = 85)
[ADn] Alternative delimiter (n = 1..9)
Decode Parameters
<D> Decode encoded file (Halt on any error )
<T> Test encoded blocks (Test for CRC errors)
Examples
XX3402 E MYFILE.ZIP (Encode MYFILE.ZIP, using defaults )
XX3402 ES MYFILE.ZIP (Encode MYFILE.ZIP, split output )
XX3402 D MYFILE.XX (Decode MYFILE.XX, using defaults )
XX3402 T MYFILE.XX (Test MYFILE.XX, display results)
ENCODING/DECODING
COMMAND-LINE PARAMETERS
Parameter 1 : Type "e" or "E" to encode the input file, creating
a single output file containing all encoded text
blocks.
Type "es" or "ES" to encode the input file, creating
an output file for each encoded text block.
Type "d" or "D" to decode the encoded text blocks
found within the input file, creating a copy of the
original binary file.
Type "t" or "T" to test the integrity of all encoded
text blocks found within the input file.
(Useful for checking individual encoded blocks)
Parameter 2 : The name of the input file to be encoded, decoded,
or tested. (Accepts optional drive and path strings)
OPTIONAL ENCODING
COMMAND-LINE PARAMETERS
Parameter 3: Column width for encoded plain-text block. Valid range
is 60..100, in increments of 4. (ie: 60, 64, 68..100)
Default column width is 72.
Parameter 4: Row length for encoded plain-text block. Valid range is
10..600, in increments of 1. (ie: 10, 11, 12, 13..600)
Default row length is 85.
Parameter 5: Alternative delimiter, for systems where the "*" XX34
delimiter may prove to be a problem.
Valid range ADn = AD1..AN9.
AD1 = ':' AD4 = '=' AD7 = '%'
AD2 = '#' AD5 = '$' AD8 = '&'
AD3 = '@ AD6 = '?' AD9 = '!'
NOTE: When decoding, XX3402 searches the first 60K of the input file
for the first valid delimiter it can find.
TO SEND A BINARY FILE
From the DOS command line, type "XX3402" followed by the parameter
"E" (encode binary file, placing all encoded text blocks into a
single output file) or "ES" (encode binary file, and split all
encoded text blocks into separate output files), followed by the
name of the binary file you want to encode.
ie: XX3402 ES FILENAME.ZIP
This will create a series of encoded text files, with the
filenames: FILENAME.X01, FILENAME.X02, FILENAME.X03, ETC...
You can then send these encoded text files via E-mail.
Make sure you only post *complete* encoded text blocks.
Do *not* split an encoded text block, as this will very
likely corrupt the encoded block you are sending.
NOTE: You can change the size of the encoded block size via
parameter 3 (column width) and parameter 4 (row length),
when encoding.
TO DECODE AN ENCODED FILE
Capture all encoded blocks you receive to a text file, in any
order. Next feed this capture file with all the normal E-mail
header/footer lines of text intact. (ie: No editing required)
From the DOS command line, type "XX3402" followed by the
parameter "D" (decode encoded text file) or "T" (Test the
integrity of individual encoded text blocks within the
capture file. Useful to test if individual encoded blocks
are corrupt.), followed by the name of the capture file
you want to decode or test.
ie: XX3402 D FILENAME.TXT
The XX3402 utility will automatically: find, sort, error-check,
and finally decode the encoded text blocks into a copy of the
original binary file. The whole decoding process if quite fast.
WHY BUILD ANOTHER ONE ?
Originally this utility started out as a simple project to improve
my Pascal skills. After trying out a few standard UU/XX encoder
utilities, I decided to try to build one of my own.
To try and improve upon the "ease of use" and error-checking
performance of the standard XX/UU encoders, I decided to add
a "header" at the beginning of each encoded text block.
XX34 HEADER FORMAT
*XX3402-050000-280194--72--85-54219----FILENAME.EXT--1-OF-12
* - Delimiter character. (Part of the XX34 ID)
Used to find each encoded text block when decoding.
Nine alternative delimiters can be used, using the
5th parameter when encoding.
XX3402 - XX34 identifying signature, incorporating the version
number.
050000 - Original (non-encoded) binary file size. XX3402 has
a file size capacity of 103,275..11,455,875 bytes,
depending on the encoded text block dimensions.
(Default capacity is: 1,156,680 bytes)
280194 - Original binary file date.
(ie: 28th of January, 1994)
72 - Encoded block column width.
(ie: 60..100 chars wide, in increments of 4)
85 - Encoded block row length.
(ie: 10..600 rows long, in increments of 1)
54219 - CRC-16 value for the original binary "block", used
to insure that the decoded binary file is identical
to the original binary-file.
FILENAME - Original binary file name.
.EXT - Original binary file extension.
1-OF-12 - Encoded text block number, and the total number of
encoded text blocks required to encode the original
binary file. (ie: Block number 1, of a total of 12)
NOTE: When more than 99 encoded text blocks are required to
encode the original binary file, XX34 switches to
hexadecimal numbering. This also occurs if the original
binary file is greater than 999,999 bytes in size.
(Hexadecimal numbering is indicated by the character 'H'
after the CRC-16 value in the XX34 header.)
ie: *XX3402-00C350-280194--60--10-43025-H--FILENAME.EXT--1-OF-7C
^^^^^^ ^ ^ ^^
Hex# Hex flag Hex# Hex#
ENCODING/DECODING BEHAVIOR
- Check if input file exists.
- Check if input file is a "zero-byte" file.
- Check if input and output filenames are identical.
- Prompt you to overwrite output file, if it already exists.
- Check if output file is read-only.
- Check if there is sufficient free memory to create encoding/
decoding buffers.
ENCODING BEHAVIOR
- Check if column/row parameters passed are valid, otherwise
defaults are used.
- Check if binary file is too big to encode using column/row
settings.
- Incorporate size, date, and name of original binary file
into each encoded text block header.
DECODING BEHAVIOR
- Search for valid XX34 identifier within the input file.
- Search for all encoded text block headers within the input
file.
- Check for missing or duplicate encoded text blocks.
- Check binary file size stored within encoded text XX34 header.
- Check that the binary file sizes and dates stored within all
encoded text headers match.
- Check that the column/row sizes stored within all encoded text
headers match.
- Check that the binary filename stored within all encoded text
headers match.
- Check that the encoded text block total stored within all
encoded headers match.
- Check if decoded binary file name already exists, allowing
user choose between: overwriting original file,
abort decoding process,
rename decoded output file.
- Decode each encoded text block, in sorted order.
- Compare the CRC-16 value stored within each encoded text block
header, with a new CRC-16 value calculated from the decoded
binary data. (This will catch corrupt encoded blocks.)
- Write decoded binary data to disk.
- Set the file date of new (decoded) binary file, to the same
date as the original binary file.
NOTE: When decoding, XX3402 does NOT require that the encoded text
blocks be edited or in sorted order. You can simply capture
all encoded blocks to a text file, and then feed this file
to XX3402 to decode.
If no errors are found when decoding, a new copy of the
original binary file will be created on disk. If an encoded
text block error is found, XX3402 will halt with an error
message indicating what the problem is.
ADDITIONAL INFO
XX3402 requires between 64..160K of free memory to run, depending
on the encoded text block size used when encoding/decoding.
The binary encoding capacity varies with the size of the encoded
text block used. The formula for determining the maximum binary
capacity for a specific encoded block size is:
Binary Capacity = Columns * (Rows - 1) * 0.75 * 255
Columns Rows Maximum Size (255 Blocks)
------- ---- --------------------------
60 10 103,275 bytes ( 100K)
72 85 1,156,680 bytes ( 1,129K)
80 200 3,044,700 bytes ( 2,973K)
100 400 7,611,750 bytes ( 7,433K)
100 600 11,455,875 bytes (11,187K)
NOTE: Remember to archive (.ARC, .ARJ, .LHA, .ZIP, .ZOO) any file
you intend to encode, often this will greatly compress the
size of the binary file, resulting in a MUCH smaller encoded
text file. Most archiving formats will create an additional
level of CRC error checking, adding extra security to the
encoding/decoding process.
CREDITS
XX3402.EXE was developed with Borland Pascal 7.01.
The final .EXE was created with Stony Brook Pascal 6.1G.
Thanks to Edwin T. Floyd's for releasing his excellent
"Crc" assembly unit. (Who was aided by the efforts of:
Gary S. Brown, Chuck Forsberg of Omen Technology,
J.R. Louvau, Mark G. Mendel of Network Systems Corporation,
Steven Satchell of Satchell Evaluations.)
A BIG THANKS! to all the folks that helped me through my beta
tests of this utility. (A BIG "Raspberry" to all the bugs that
showed up in my source-code to torment me. <g>)
- Guy
Comments/bug-reports can be passed on through the Pascal confs
on the following networks: FIDO, ILINK, NANET, RIME
...Or via "snail-mail":
Guy McLoughlin
P.O. Box 519,
Station A,
Toronto, Ontario,
Canada M5W 1E4