Question

I have been using the following code to convert a string into an md5 hash:

password = passwd.hexdigest()

passwd is supposed to be 'test123' so it is supposedly turning that into an md5 hash.

It gives me the following:

6adf97f83acf6453d4a6a4b1070f3754

Now when you decrypt that hash, it does not go back to 'test123'.

This is the correct md5 hash that goes back to 'test123':

cc03e747a6afbbcbf8be7668acfebee5

This is the code:

passw = request.forms.get('password')
password = hashlib.md5(str(passw)).hexdigest()

How can I work this out so it gives me the correct reversable hash?

Was it helpful?

Solution

6adf97f83acf6453d4a6a4b1070f3754 is actually md5 value of "None", so maybe you get something wrong elsewhere.

Let's say you didn't actually get the passw from request.forms, and parse the None to str(), then gives it to md5().hexdigest(), you'll just get the result.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top