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


Groups > comp.lang.python > #86734

Re: Md5 is different in Windows and Linux

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <gheskett@wdtv.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'subject:Windows': 0.02; 'computed': 0.09; 'data:': 0.09; 'skip:2 30': 0.09; 'python': 0.11; 'def': 0.12; 'windows': 0.15; 'hashlib': 0.16; 'md5': 0.16; 'soap,': 0.16; 'true:': 0.16; 'wrote:': 0.18; 'import': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'skip:e 30': 0.24; 'cheers,': 0.24; 'code:': 0.26; 'header:In-Reply-To:1': 0.27; 'linux.': 0.31; 'file': 0.32; 'run': 0.32; 'linux': 0.33; 'url :non-standard http port': 0.33; 'received:66': 0.35; 'monday': 0.35; 'but': 0.35; 'there': 0.35; 'skip:o 20': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'received:unknown': 0.61; 'break': 0.61; 'march': 0.61; 'content- disposition:inline': 0.62; 'header:Message-Id:1': 0.63; 'different': 0.65; 'received:204': 0.75; '2015': 0.84; 'amazed': 0.84; 'boxes': 0.91
X-Spam-Status No, score=0.5 required=5.0
X-Spam-Level
From Gene Heskett <gheskett@wdtv.com>
To python-list@python.org
Subject Re: Md5 is different in Windows and Linux
Date Mon, 2 Mar 2015 08:07:12 -0500
User-Agent KMail/1.9.10 (enterprise35 0.20100827.1168748)
References <CA+QVAb4D1JTnaQ5ZOaB51syt1_NePt+QeSHOxEmnhMjxr10BEQ@mail.gmail.com>
In-Reply-To <CA+QVAb4D1JTnaQ5ZOaB51syt1_NePt+QeSHOxEmnhMjxr10BEQ@mail.gmail.com>
X-KMail-QuotePrefix >
MIME-Version 1.0
Content-Type Text/Plain; charset="utf-8"
Content-Transfer-Encoding 7bit
Content-Disposition inline
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.19
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.38.1425302038.13471.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1425302038 news.xs4all.nl 2897 [2001:888:2000:d::a6]:43323
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:86734

Show key headers only | View raw



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>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web