Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #86734 > unrolled thread

Re: Md5 is different in Windows and Linux

Started byGene Heskett <gheskett@wdtv.com>
First post2015-03-02 08:07 -0500
Last post2015-03-02 08:07 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Md5 is different in Windows and Linux Gene Heskett <gheskett@wdtv.com> - 2015-03-02 08:07 -0500

#86734 — Re: Md5 is different in Windows and Linux

FromGene Heskett <gheskett@wdtv.com>
Date2015-03-02 08:07 -0500
SubjectRe: Md5 is different in Windows and Linux
Message-ID<mailman.38.1425302038.13471.python-list@python.org>

On Monday 02 March 2015 01:19:46 Sarvagya Pant wrote:
> Hello, I am amazed that the  md5 of a file given by python in windows
> is different than that of linux. Consider the following code:
>
> import hashlib
> def md5_for_file(f, block_size=2**20):
>     md5 = hashlib.md5()
>     while True:
>         data = f.read(block_size)
>         if not data:
>             break
>         md5.update(data)
>     return md5.hexdigest()
>
> f = open("somefile.txt")
> print md5_for_file(f)
>
> When I run the program I get the checksum value:
> 2f9cc8da53ee89762a34702f745d2956
>
> But on this site http://onlinemd5.com/ and on linux it has value
> E10D4E3847713472F51BC606852712F1.
>
> Why is there difference in value of Checksum computed by python in
> windows and other system.?

Line endings?

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web