-1

Question is simple. I have:

import hashlib
m = hashlib.md5()
m.update(b"My name is Joe")
x = m.hexdigest()
print(x)

this outputs:

c923c2de3064b7be0223d42697ad57e2

now how do I decrypt this?

Robert
  • 10,126
  • 19
  • 78
  • 130
  • Hash functions are irreversible by design. – vaultah Jun 08 '14 at 12:13
  • Well if the user comes back to enter a password or something that was hashed how would you verify it if it's unreversible? – Robert Jun 08 '14 at 12:17
  • 1
    @robertrocha You would verify the entered password by hashing it and then matching it with the _already hashed_ password which is in your database. – xyres Jun 08 '14 at 12:35

1 Answers1

0

MD5 is a hash function. In other words, it is not intended to be reversed. The only way to reverse MD5 would be to test all the possibilities:

for word in all_the_possible_words():
    if md5(word) == my_hash:
        print("I found the word!", word)
        break

But that would not be possible in a reasonnable amount of time unless you have some information about the word you're looking for (for instance the number of characters, the characters it uses,...).

Another possibility would be to use rainbow tables.

julienc
  • 19,087
  • 17
  • 82
  • 82