title: Adding a hash of the string to the same line in Python 3
body: <p>I'm trying to write a script which would take a password txt file (with cleartext passwords in each line) as input. The new output txt file would include passwords in cleartext and hash (SHA1) in each line as:</p>
  
  <p>password:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
  password2:2aa60a8ff7fcd473d321e0146afd9e26df395147
  ...</p>
  
  <p>So far, this is what I have:</p>
  
  <hr>
  
  <pre><code>wordlist = input("Input name of wordlist file: ")
  result = input("Enter name of result file: ")
  
  with open(result, 'w') as results:
      for word in open(wordlist).read().split():
          hash = hashlib.md5(word.encode())
          hash.update(bytes(word, 'utf-8'))
          results.write(word + ':' + hash + '\n')
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "rainbow.py", line 11, in &lt;module&gt;
      results.write(word + ':' + hash + '\n')
  TypeError: must be str, not _hashlib.HASH
  </code></pre>
  
  <p>Thanks a bunch!</p>