Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import hashlib
  2.  
  3. f = open('dictionary.txt')
  4. words = f.read().split('\n')
  5.  
  6.  
  7. cleanWords = []
  8. for word in words:
  9. cleanWords.append(word.rsplit)
  10.  
  11.  
  12. thedict = {}
  13. thehash = hashlib.md5()
  14.  
  15. for word in words:
  16. thehash.update(word)
  17. key = thehash.hexdigest()
  18. thedict[key] = word
  19. #print key
  20. #print word
  21.  
  22. #prints the entire dictionary with keys and value pairs
  23. print thedict
  24.  
  25. outFile = open('rainbow.csv', 'a')
  26.  
  27. for item in thedict:
  28. print item, thedict[item]
  29. outFile.write(item + "," + thedict[item] + "\n")
  30. outFile.close()
  31.  
  32. ## to search the thedict to find the word that is paired to the MD5 hash
  33. print thedict["insert the hash value from scott"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement