md5 for large files

Dave Brueck dave at
Tue Mar 4 20:13:10 CET 2003

On Tue, 4 Mar 2003, Bob Ballard wrote:

> Can someone provide me with a snippet or pointer to usinging Python to
> verify the md5 value for a large file?  All examples I've seen are for a
> small string.  I'm not yet using GPG for NT and I need to verify or generate
> md5 values for file xfers.

Hi Bob,

How about:

import md5
m =
f = open('somefile','rb')
while 1:
  data = # Read a block
  if not data: break
print m.digest()


More information about the Python-list mailing list