title: How to fix Unicode encode error using the hashlib module?
body: <p>After multiple searches I have not been able to determine how to avoid an error stating: "Unicode-objects must be encoded before hashing" when using this code:</p>
  
  <pre><code>    pwdinput = input("Now enter a password:")
      pwd = hashlib.sha1()
      pwd.update(pwdinput)
      pwd = pwd.hexdigest()
  </code></pre>
  
  <p>How can I get past that error? How do you encode Unicode-objects?</p>