[Tutor] MD5 Digest for files

Steve Nelson sanelson at gmail.com
Fri Jan 19 16:15:25 CET 2007


Hello,

I want to create a dictionary of files and md5sums for a given
directory.  It seems, however, that md5 works with strings or
read-only buffers, and can't be passed a file.

What I want to do is something like:

for f is os.listdir("."):
  d[f] = someFunctionThatReturnsMD5Sum(f)

Has this wheel already been invented?  I can't see how to operate on
the file itself.

S.


More information about the Tutor mailing list