I’m trying to have python read some lines of text from a file and then convert them to an md5 hash to compare to the one the user entered.
I’m using f = open(file, 'r') to open and read the files and everything is working fine but when it hashes the word its not the right hash for that word.
So I need to know how to remove the spaces or the \n at the end that is causing it to hash incorrectly.
If that makes sense. I didnt really know how to word it.
The code: http://pastebin.com/Rdticrbs
I have just rewritten your pastebin code, because it’s not good. Why did you write it recursively? (The line
sys.setrecursionlimit(10000000)should probably be a clue that you’re doing something wrong!)This will obviously be slow, because it hashes every word in the wordlist every time. If you are going to look up more than one word in the wordlist, you should compute (once) a mapping of hashes to words (a reverse lookup table) and use that. You may need a large-scale key-value storage library if your wordlists are large.