CHKSUM - a versatile checksum calculator
Licensed under the European Public License (EUPL)

This program was created to provide a means of calculating and verifying
checksums utilizing several different checksum algorithms. The program is
targeted at older computer systems of the 16-bit and early 32-bit era. It is
however also functional on newer systems, though there will likely be faster
implementations for current systems.

The DOS release of this software includes two executables:

  - CHKSUM.EXE is a 16-bit executable compatible with 8088 CPUs upwards
  - CHKSUM32.EXE is a 32-bit protected mode executable that requires a
    386 CPU or newer. It is however much faster than the 16-bit version.

The following checksum algorithms are supported:

  Cryptographic checksum algorithms:

    - md5 (default), md4
    - sha-1, sha-224, sha-256, sha-384(*), sha-512(*)
    - sha3-224, sha3-256, sha3-384 and sha3-512

  (*) These algorithms are particularly slow when running the 16-bit
      version, as the compiler used to generate it emits slow code for
      64-bit integer arithmetic. The sha3 variants are not affected.

  Non-cryptographic checksum algorithms:

    - bsdsum (16-bit BSD checksum)
    - fletcher16 (modulo 255), fletcher32 (modulo 65535)
    - adler32
    - crc32 (polynome 0x04C11DB7) and crc32c (polynome 0x1EDC6F41)

Invoke Chksum without command line arguments to show usage info.

The Chksum distribution comes with a file FILES.SUM. It contains the
checksums for the files in the distribution. To verify the integrity, invoke
from inside the extracted Chksum directory:

   > chksum -c -v files.sum

The output will be of the following form if all checksums match:

   OK  CHKSUM.EXE
   OK  LICENSE
   2 files processed, all ok.

Otherwise errors are indicated:

   BAD CHKSUM.EXE
   OK  LICENSE
   2 files processed, 1 with invalid checksum!

Checksums for files can be calculated by giving their filenames as command
line arguments:

   > chksum CHKSUM.EXE LICENSE
   da23f3d00243ecc32876a9e76138e469  CHKSUM.EXE
   061593197a8897742a5bd4f3be61131d  LICENSE
   2 files processed.

A different checksum algorithm may be specified by giving the -a command
line argument. The following calculates a SHA3-224 checksum:

   > chksum -a sha3-224 CHKSUM.EXE
   e9de063658ee628d73b9cd4b392c95a572c9efd3181fb28c8631033c  CHKSUM.EXE
   1 files processed.

To produce a checksum file containing the calculated checksums and the
corresponding filenames, use the -o OUTFILE argument:

   > chksum -o FILES.SUM CHKSUM.EXE LICENSE

This generates a file FILE.SUM. If the file already exists, Chksum will
not overwrite it without the users consent. It instead prints:

   error: would overwrite checksum file FILES.SUM (force with -f)

As the error message indicates, the command line argument -f instructs
Chksum to overwrite the existing file.

You already know the -c and -o commands. They may be paired with -v to show
all processed files. Otherwise only the number of currently processed files
and files with a bad checksum are shown.

Command -c may be paired with -i to ignore files missing on the file system
but included in the checksum file.

To write an error log file, add -e LOGFILE as an argument. All errors are
then written to LOGFILE instead of the console.

Chksum currently neither supports wildcard expansion for files given at the
command line, nor can it recurse into subdirectories. The following will
throw an error:

   > chksum *.exe
   error: cannot calculate hash for *.exe: No such file or directory
   1 files processed, 1 failed!

Chksum instead supports list files. These are text files containing
filenames. There must be at most one filename per line. When you invoke
Chksum like

   > chksum @FILES.LST

the @ in front of FILES.LST identifies it as a list file. In consequence,
checksums are calculated for all files listed in FILES.LST.

Both checksum and list files may contain empty lines or comment lines.
Use ; or # as the first non-blank character to make a comment line.


Bernd Boeckmann
Aachen, Germany
