Drophash in Python

A while back, I wrote a little utility in raw Win32 for getting the MD5 and SHA-1 hashes of a bunch of files dragged on to it. As a little 5-finger exercise for Python, I thought I'd do the same again.

Unfortunately, the standard distro only comes with Tk for its GUI set, and to get a cross-application drag and drop requires installing some extra TK DnD library, so if it needs to install something above and beyond Python 2.5 (that's the version I used, but it doesn't use any new language features), I might as well require something useful — so I require wxPython instead (and I used version

This one is neater than the Win32 version since I can use the nifty HTML window widget and place the results for each new batch of files in a table, with the files and hashes cross-indexed.

Simply cut, paste and save the text of the section below as drophash.py, and save the linked icon file drophash.ico to the same folder, and double-click.

As an alternative, a pure Tk version. Not so fancy; you have to select the files you want (or put them on the command line). Just extract this section as tkhash.py and double click…

Now for IronPython 1.1 — annoyingly the WebBrowser control doesn't accept normal DnD, nor does it let you paint it to a bitmap to blit on another control, so this one uses a ListView.

Jython next; but rather than coding the messy .ico to image transformation again, use a PNG icon instead:—