title: Python - Hashlib MD5 differs between linux/windows
body: <p>I have a python app in which I am creating packages in windows to be used and later compared in a linux python app.  I am creating an md5 for a file in windows to be checked later in linux.  The problem is that the same code on the same file gives different Md5 hash results in each environment.  Below is the method I use to calculate the Md5.  (It is the same code on each end, and I am using Python 2.6.5 for both windows/linux environments)  When I run this on the same file in different environments, I get md5 hashes that do not match.</p>
  
  <pre><code>def md5_for_file(filePath):
          md5 = hashlib.md5()
          file = open(filePath)
          while True:
              data = file.read(8192)
              if not data:
                  break
              md5.update(data)
  
          file.close()   
          return md5.hexdigest()
  </code></pre>
  
  <p>Any ideas or suggestions are appreciated.  </p>