title: Compare result from hexdigest() to a string
body: <p>I've got a generated MD5-hash, which I would like to compare to another MD5-hash from a string. The statement below is false, even though they look the same when you print them and should be true.</p>
  
  <pre><code>hashlib.md5("foo").hexdigest() == "acbd18db4cc2f85cedef654fccc4a4d8"
  </code></pre>
  
  <p>Google told me that I should encode the result from <code>hexdigest()</code>, since it doesn't return a string. However, the code below doesn't seem to work either.</p>
  
  <pre><code>hashlib.md5("foo").hexdigest().encode("utf-8") == "foo".encode("utf-8")
  </code></pre>