PyCheckSum is a simple python program for generating and verifying file checksums. At the present, it supports the MD5 and CRC32 checksums. The program is controlled only through the command line parameters.

The project is currently hosted on SourceForge.

Command-line

The command-line arguments cotrols the actions taken by the program and, to some extent, its appearance.

The program can operate in two main mode:

If you forget the syntax, just call the program with -h or --help arguments and it will display a short help.

$ ./pychecksum.py -h
usage: pychecksum.py [-xvg] [--md5|--sfv] (-cFILE | [-oFILE] [-bPATH] file1 [file2] [-i PATH1])

options:
  -h, --help   show this help message and exit
  -g, --gnome  use the gnome interface
  --md5        check or create MD5's
  --sfv        check or create SFV's
  -iDIR        ignore given dir
  -x           expand the details on stat-up
  -v           print status on the console
  -cFILE       verify checksums stored in FILE
  -oFILE       store checksums in FILE
  -bPATH       compute paths relative to PATH
  -fPATH       compute PATH's checksum and store it in PATH.{md5|sfv}
  -dPATH       compute PATH's checksum and store it in PATH.{md5|sfv}

Selecting a checksum type

The program supports at this time these checksums:

To select one or the other, just use one of the --md5 or --sfv commad-line switches. If none of this is given, the program will use MD5, by default.

Checking or storing checksums?

The program can be used both for checking checksums and for verifying them later. It should be also able to verify checksums generated by other programs, like the command-line utility md5sum or by the cksfv.

Checking

To verify the checksums stored in a file, use the -c switch followed by the name of the file to be checked. If the file stores MD5 checksums, this is all you need to do. If the file is a SFV file, than you also need to use the --sfv switch.

Generating

The program can be also used to create checksums. The type of the checksum is selected with the --sfv or --md5 switches.

Note
If you try to use both, the last one found on the command line remains the active one. If none of them is present, the MD5 is used, by default.

The checksums are printed at the console, by default. To output them in a file, you can redirect the console using standard redirectation means, or, better, using the -o switch, followed by the name of the file to store the checksums.

Warning
The file that is going to store the checksums is deleted, if found, without any warning.

Generation shortcuts

The -f and -d are shortcuts for generating checkums. When using any of them, the checksums are stored in a file with the name obtained by adding an .md5 or .sfv extension to the name of the file or, respectively, directory to be checked. These are used extensively on Win32, where the program is integrated with the Windows Explorer.

Win32 integration

On Win32 platform, the program can be tightly integrated in the Windows Explorer. To do this, you must call first register it with the Windows Explorer.

$ pychecksum.py --register

After this, you will be able to do the following directly from the Window Explorer:

If later you decide to remove this integration, just unregister the program using:

$ pychecksum.py --unregister

Be verbose

If you use the -v flag, the program will be a bit more verbose on the console, like printing the final statistics after finishing generating or verifying some checksums.

GUI

Window Layout

The program consists of only one window. I have try to show as much useful information without cluttering the interface too much.

MainWindow01.png

  1. The Title Bar displays the name of the sum file and how much of it has been processed so far. The percent is computed based on bytes, not files processed.

  2. The top part of the window shows the general statistics of the sumfile:

    • the total number of files (Files)

    • if we are verifying a sumfile, the Bad, Good and Missing files detected so far

    • the bytes of all files (Bytes)

  3. Bellow the file statistics we have the time statistics. These are the elapsed, remaining and total times. The remaining and total might change a lot and are only informative.

  4. The Current label shows what file is processed at that moment. After finishing the processing, it will show the state of the processing (for example ALL FILES ARE OK)

  5. The Details allows you to have more verbose info on what’s going on. Expanding it might decrease the processing speed, so it is better to wait till the processing is over. Once the processing is over, you will also be able to show only certain items using the filter controls (Good, Bad and Missing checkboxes)

  6. At the bottom of the window we have two progressbars: one for the files processed and one for the number of bytes processed. The percentage represent the progress done so far relatively at the total number of files and, respectively, the total number of bytes to be processed. The pecentage of bytes processed is the shown in the title bar, too.

The Details view

By clicking on the small triangle located in front of Details label, you can show or hide the list of files processed. During checking, a small icon will be displayed in the front of each file, showing its good, bad or missing status.

Note
By default, the program starts with the Details collapsed. You can force it to start with the Details expanded by using the -x switch on the command-line.

MainWindow02.png

Bellow the list of files, there are three checkboxes:

They are used for filtering the files shown by the details listbox and are active only after the processing of all the files has been finished. Until that time, all files are shown.

Note
You can click on the column headers from the listbox to sort the files after that column (for example, to sort after the good, bad or missing status, or alfabetically)

Finished processing

After processing all the files, the program will display the status in the Current label. For a verification of some checksums that went without any trouble, this will be ALL FILES ARE OK.

MainWindow03.png

After finishing the processing, the checkboxes from the Details will be active and you will be able to filter what files to show and what to hide.

MainWindow04.png