Need decoder/encoder source to transfer binaries

Root Boy Jim rbj at cmr.icst.nbs.gov
Fri Jun 24 09:21:44 AEST 1988


? From: Andrew Lue <andrew at nsc.nsc.com>

? Does anyone know of programs which can encode and decode binaries?
? If you do, please tell me where I can retrieve the source.

? UUDECODE and UUENCODE won't help because I need to transfer binaries
? between VMS and UNIX systems.  FTP doesn't work well. We've had problems
? with Kermit, too.

Try binary in FTP mode. But why won't uu{en,de}code work? Yes, VMS doesn't
have them, but they are trivial to write and public domain.

Of course you could write your own version. Here is the basic approach.

Your utility, encode takes a file name as it's argument. The first thing
it outputs is the filename and its length. Then, read a character, C.
Output ('@' + ((C >> 4) & 15)). Output ('@' + (C & 15)). Every 32 chars
read (64 chars written) output a newline. Finally, output "x\n".

The decode utility reads the filename from the first line and creates it.
For each pair of characters read (call them X and Y, if they are "x\n" stop),
write (((X & 15) << 4) + (Y & 15)). Trivial to code.

Uu{en,de}code writes three chars into four, packing the next six bits into
the next output character and biasing the result by "`". Each line is
preceded by the *input* character count, biased by " ", and followed by
a newline. The "M" that you see so often reflects a full line of 45 input
characters ('M' - ' ' = 45), encoded into 60 output characters.

Any extra characters needed to make a group of three are treated as nulls,
altho their value really doesn't matter. Good luck and have fun!

? Andrew H. Lue               {decwrl|sun}!nsc!andrew

	(Root Boy) Jim Cottrell	<rbj at icst-cmr.arpa>
	National Bureau of Standards
	Flamer's Hotline: (301) 975-5688
	The opinions expressed are solely my own
	and do not reflect NBS policy or agreement
	Careful with that VAX Eugene!



More information about the Comp.unix.questions mailing list