reading hash from md5 in python
<p>I can't seem to find anything on the interwebs on this.</p>

<p>Basically I have a bunch of xml files with a respective md5 file for each</p>

<p>I want to be able to compare each xml with its md5 hash to ensure they have been sent to us correctly.</p>

<p>I have tried running this as a binary file but I don't think it works.</p>

<pre><code>def read_hash_from_md5_file(md5_filename):

    with open(md5_filename,"rb") as file:
        for line in file:
            print(line)
</code></pre>

<p>this returns <code>b' \xc0\xff\xae\x91\x1c\tJ\xc5~\xbe\x8d\x93\xad\xf3\x0c'</code>.</p>

<p>where when I calculate the hash for the xml I get '20c0ffae911c094ac57ebe8d93adf30c' </p>

<p>thanks for the help.</p>