java digest, by Charlton Rose

java digest is a tool for generating secure message digests using algorithms such as SHA and MD5.

What is a secure message digest?

A message digest is a "digital signiature" that has been generated from a sequence of bits, such as a file. Given any message digest generation algorithm, the same input will always produce the same digest; however, if the input is modified in the slightest degree, the same algorithm will produce a noticibly different digest.

example:

Using the MD5 digest generation algorithm, the message

In the beginning God created the heaven and the earth.
produces the following digest:
0b4591090d210426dbaae959fc5d5df4

However, the slightly altered message

In the beginning Dog created the heaven and the earth.
produces a very different digest:
3f2701517d18bb2d537e41dc7773d710
The changed digest signals that the input data has been modified.

Digests can be used to verify file integrity. If you suspect that a file has been modified from the original, you can compute its digest and compare it to the previously-computed digest of the original file. If the digests don't match, then the file has been modified.

A digest generation algorithm is called "secure" if, given a complete knowledge of the algorithm and any arbitrary digest, it is computationally intractable to produce a data set corresponding to the given digest. In lay terms, a secure digest generation algorithm makes it impossible for your enemies to modify your data without modifying the digest also. Digests generated by such algorithms are called secure digests.

Installing java digest

java digest is written entirely in Java, so it can theoretically run on any platform sporting a JVM. However, it has only been tested on JVM 1.1.1 for Microsoft windows.

To install, download the zip file digest10.zip (4607 bytes) and extract the class files to a directory of your choosing.

Note to Windows users: A batch file called "digest.bat" is included in the zip archive. If you place this file somewhere in your path, you will be able to run java digest from any drive or directory. Note, however, that you will probably have to modify the batch file so that it works on your system.

Running java digest

Change to the directory containing the java digest class files and type "java digest" for a summary of the command-line syntax.

The command-line syntax for java digest is as follows:

java digest algorithm filename [blocksize]

The parameters are defined below:

algorithm
The name of the digest generation algorithm: MD5 or SHA.
filename
The name of the input file for which you want to compute a digest.
blocksize (optional)
The size of the input buffer used to read the file. Larger number increase performance but require more memory. Specifying a number for the block size turns verbose mode on so that you can see the progress of the computation. If you want to specify a block size but do not want verbose output, precede the number with a minus sign. (Note: The default block size is 1024.)

Legal Stuff

java digest is freeware. You may copy, distribute, and modify this distribution according to the desires of your heart.

java digest is provided as is, without warranty of any kind. The author shall not be liable for damages of any kind.

Use of this software indicates you agree to all of these terms.

Contacting the Author

For more information about the author and how to contact him, visit the Sharky's Solutions web site at

http://sharkysoft.com/

Charlton Rose
June 23, 1997