John Salerno <[EMAIL PROTECTED]> writes:
> Just a quick md5-related follow-up question: I was experimenting with
> it and making md5 sums for strings, but how do you use the md5 module
> to create a sum for an actual file, such as an .exe file?

m = md5.new()
f = file('foo.exe', 'b')  # open in binary mode
while True:
   t = f.read(1024)
   if len(t) == 0: break    # end of file
   m.update(t)
print m.hexdigest()
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to