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


Groups > comp.lang.python > #86703

Md5 is different in Windows and Linux

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <sarvagya.pant@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*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; 'true:': 0.16; 'filename:fname piece:txt': 0.16; 'import': 0.22; 'print': 0.22; 'skip:e 30': 0.24; 'code:': 0.26; 'message- id:@mail.gmail.com': 0.30; 'linux.': 0.31; 'file': 0.32; 'run': 0.32; 'linux': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'charset:us-ascii': 0.36; 'skip:o 20': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:\xc2 10': 0.60; 'break': 0.61; 'skip:o 30': 0.61; 'different': 0.65; '8bit%:100': 0.72; 'amazed': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=sxAifCchxR5w8HUSmmpKIUMkKLk1zMm+RSs5pZYHXu0=; b=Jd0t5ql/Ej6d4xauQT3RUyH6w8lb9+JgE6T6oG/vBJjdU2ZTQxlEDIKeL8SI2ztxkm NjKK2tQKGVVR3oelhRmfV+ZiRZK7VJU7Mz63nulz+bqFHdwodQiBj2LU4cVYh0Iqgg+h ypxjAiYukoY6G8BDawDKsf8sqVjY/irn0unFJrwKATEEE1nILuW8bv1bk4Zt/gLSpZCk Iik9Mr2UGqWvaqD01xmohOZJEzjkydNcr+vVnH/lDZQ4qcH5dMVDreLFERu+RaTwN4Vb 1qnuFlEbdDdk29O6BARXTglPu5beMrkTSSRhwH5wx9HBFqn69nA1uB2HvnsAvSbQRhAU wubw==
MIME-Version 1.0
X-Received by 10.112.201.69 with SMTP id jy5mr8361020lbc.78.1425277186818; Sun, 01 Mar 2015 22:19:46 -0800 (PST)
Date Mon, 2 Mar 2015 12:04:46 +0545
Subject Md5 is different in Windows and Linux
From Sarvagya Pant <sarvagya.pant@gmail.com>
To python-list@python.org
Content-Type multipart/mixed; boundary=001a11c373546d6c01051048344b
X-Mailman-Approved-At Mon, 02 Mar 2015 09:43:47 +0100
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.16.1425285828.13471.python-list@python.org> (permalink)
Lines 67
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1425285828 news.xs4all.nl 2862 [2001:888:2000:d::a6]:53043
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:86703

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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.?

-- 
*sarvagya*

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


Thread

Md5 is different in Windows and Linux Sarvagya Pant <sarvagya.pant@gmail.com> - 2015-03-02 12:04 +0545
  Re: Md5 is different in Windows and Linux Denis McMahon <denismfmcmahon@gmail.com> - 2015-03-02 10:24 +0000
  Re: Md5 is different in Windows and Linux sohcahtoa82@gmail.com - 2015-03-02 11:14 -0800
    Re: Md5 is different in Windows and Linux Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2015-03-03 00:45 +0100

csiph-web