I am writing a program that will encrypt words from a list until the hash matches the one you are trying to decrypt.
The problem I am having is that when the hash is encrypted, it does not loose any of the whitespace characters and I get hashes like:
b'\x0by\x07\xb4\xe8\xd9\x90d\xaa\xd9\xe6\x1d\xfa\x92\xc2\xaf
and not 63eb1dea1692fc53800b20be983e9a8b
Is there any way I can get rid of all whitespaces before I encrypt?
This is my code:
import hashlib
def computeMD5hash(string):
m = hashlib.md5()
m.update(string.encode('utf-8'))
md5string=m.digest()
return md5string
wordlist = open('wordlist.txt', 'r')
words = wordlist.readlines()
words = [x.strip('\n') for x in words]
print("Searching...")
for i in words:
for x in words:
print(i+x)
out = computeMD5hash(i+x)
print(out)
if out == '63eb1dea1692fc53800b20be983e9a8b':
print(i+x)
break
Edit: Sorry, it's not just whitespace, but there aren't supposed to be backslashes in the hash, and I feel like either the encoding is wrong or my method for encrypting is not correct. All I know is that the output is wrong, and I have checked it against multiple sources.