title: compute crc of file in python
body: <p>I want to calculate the <a href="http://en.wikipedia.org/wiki/Cyclic_redundancy_check" rel="noreferrer">CRC</a> of file and get output like: <code>E45A12AC</code>. Here's my code:</p>
  
  <pre><code>#!/usr/bin/env python 
  import os, sys
  import zlib
  
  def crc(fileName):
      fd = open(fileName,"rb")
      content = fd.readlines()
      fd.close()
      for eachLine in content:
          zlib.crc32(eachLine)
  
  for eachFile in sys.argv[1:]:
      crc(eachFile)
  </code></pre>
  
  <p>This calculates the CRC for each line, but its output (e.g. <code>-1767935985</code>) is not what I want.</p>
  
  <p>Hashlib works the way I want, but it computes the md5:</p>
  
  <pre><code>import hashlib
  m = hashlib.md5()
  for line in open('data.txt', 'rb'):
      m.update(line)
  print m.hexdigest()
  </code></pre>
  
  <p>Is it possible to get something similar using <code>zlib.crc32</code>?</p>