python snippet request: calculate MD5 checksum on 650 MB ISO cdrom image quickly

Tyler Eaves tyler at tylereaves.com
Tue Oct 24 12:52:31 EDT 2000


Do you really need to checksum the whole file? Maybe try checksuming
the first k of every MB, or something along those lines?

On Tue, 24 Oct 2000 12:39:51 -0400, "Warren Postma"
<embed at NOSPAM.geocities.com> wrote:

>I am writing some python scripts to manage downloading (and re-downloading)
>ISO images from FTP mirrors, and doing MD5 checksums on the received files
>to make sure they are intact.
>
>I noticed that there is an MD5 message digest module in Python. But it only
>accepts STRINGS.  Is there some way to pass a WHOLE FILE to it, less
>awkwardly than having a WHILE loop that reads 1k chunks and passes it along
>to the MD5 module.
>
>A new function in the md5 module, md5.md5file(filename) would be nice, if
>anyone is listening, for a future python 2.x release.
>
>I'll contribute a patch if anyone thinks it's a good idea.
>
>If there's already a one-to-ten line method that doesn't involve iterating
>(SLOWLY) over chunks of the file that got loaded into Strings that would be
>great.
>
>My current method is to use os.popen("md5 "+filename"), which then spawns a
>command line md5 utility, which seems to me to be kind of wasteful and slow.
>
>Warren Postma
>ZTR Control System
>
>

---
Tyler Eaves

Visit Ultra Coaster Central!
The internet's largest repository
of Ultra Coaster Tracks!

http://www.ultracoastercentral.com


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



More information about the Python-list mailing list