title: 2 scripts returning 2 different hashes for what i thought was the same string
body: <p>i'm trying to build an MD5 'cracker' and using two different scripts to do it, the first takes a list of words from a wordlist (huge word list.txt), then hashes them and writes them to another file(WordsHash.txt). The second then takes a user defined word, hashes it and compares it to the hashes in WordHash.txt, but i'm getting different hashes for 'the same' string.</p>
  
  <p>first script:</p>
  
  <pre><code>import hashlib
  
  hashes = open("WordsHash.txt", 'w')
  
  m = hashlib.md5()
  
  with open("huge word list.txt") as words:
      words = words.readlines()
  
      print "processing..."
  
      for line in words:
  
          line = line.replace("\n", "")
  
          m.update(line)
  
          word_hash = m.hexdigest()
  
          line = "%s %s\n" % (line, word_hash)
  
          hashes.write(line)
  
  print "done."
  
  hashes.close()
  </code></pre>
  
  <p>and the second script:</p>
  
  <pre><code>import hashlib
  
  
  f = open('WordsHash.txt')
  
  p = '\'due'
  
  password = hashlib.md5()
  
  password.update(p)
  
  password = password.hexdigest()
  
  print "%r %r" %(password, p)
  
  
  
  for line in f:
  
      lines = line.split(" ")
  
      lines[1] = lines[1].replace("\n", "")
  
      word_hash = lines[1]
  
      if word_hash == password:
  
          print "found it, %s" % line
  
          exit(0)
  </code></pre>