title: SHA1 hash differ between openssl and hashlib/pycrypto
body: <p>Why does the hash from using openssl differ from the ones I get in python?</p>
  
  <pre><code>$ echo "Lorem ipsum" | openssl dgst -sha1 -hex
  (stdin)= d0c05753484098c61e86f402a2875e68992b5ca3
  $ python
  &gt;&gt;&gt; from hashlib import sha1
  &gt;&gt;&gt; sha("Lorem ipsum").hexdigest()
  '94912be8b3fb47d4161ea50e5948c6296af6ca05'
  &gt;&gt;&gt; from Crypto.Hash import SHA
  &gt;&gt;&gt; SHA.new("Lorem ipsum").hexdigest()
  '94912be8b3fb47d4161ea50e5948c6296af6ca05'
  </code></pre>
  
  <p>Are the strings not equivalent? am I missing something obvious?</p>
  
  <p><strong>Edit:</strong> Thanks for spotting it. Was piping a saved message from a file which also suffer from the same annoying newline issue. </p>
  
  <pre><code>$ cat message | openssl dgst -sha1 -hex
  'keep whacking your head mate, it wont be the same'
  $ echo -n $(cat message) | openssl dgst -sha1 -hex
  'ok, you got me, for now' 
  </code></pre>