ABOUT THIS PROGRAM
------------------

md5tee is meant for use in shell scripts.  It was written for situations
where you have a large stream of data which you need a checksum of, but
the data has not yet been written to disk or doesn't need to be written
to disk.

md5tee lets you compute MD5 checksums "on the fly" in shell pipelines,
without needing to save checksummed data to disk (or to wait until all
data has been computed, read, or downloaded before beginning to compute
a checksum).  The checksumming step can happen in parallel with any
other I/O.

While md5sum, for example, allows you to compute the checksum at the
end of a pipeline, the actual data fed to md5sum will be discarded; if it
still has to be processed by some other program, it must be saved to disk!

For example,

wget -O- http://www.oggs.net/cool-song.ogg | md5tee cool.md5 | ogg123 -d oss -

will let you play an Ogg music file from the Internet and simultaneously
calculate its checksum -- without any intermediate storage on a local disk.
In this case, the checksum is written to the file "cool.md5".

(This application is not very useful, but there are other cases where it's
more important to checksum something as it's being downloaded or copied, to
be sure it hasn't been corrupted or modified.)


USING MD5TEE
------------

In all cases, md5tee reads the content (the data for which a checksum is to
be computed) from its standard input.

It will write a copy of the content to some location (by default, standard
output) and the standard ASCII representation of the MD5 checksum of the
content to another location (by default, standard error).  The delay between
input and output should not be significant in most applications.  (On current
hardware, computing MD5 is faster than many I/O sources; for example, few
people can download data over a network faster than their machines can
compute its checksum.)

By default, reads occur with a block size of 16384, so you won't see any
output until 16384 bytes have been read from the input, or an end of file
occurs on the input (whichever comes first).


SYNTAX
------

md5tee [-a] [-r] [file]

If a filename is provided, write checksum to file instead of to stderr.

-a: append to output file instead of overwriting
-r: reverse (write output into file and checksum to stdout)

Input is always read from stdin.

The possible combinations are thus

md5tee: content to stdout, md5 to stderr
md5tee file: content to stdout, md5 to file
md5tee -a file: content to stdout, md5 appended to file
md5tee -r file: content to file, md5 to stdout
md5tee -r -a file: content appended to file, md5 to stdout
