-3

Possible Duplicate:
How to output MD5 hashed password in plain text?

I have a little problem, below is nmy code is a '$teacherpassword' variable where it contains the user's password with salt (random characters) around it.

$teacherpassword = md5(md5("g3f".$teacherpassword."rt4"));

Now lets say the passowrd is "Cricket", then if I echo $teahcerpassword, it does not output the word "Cricket", it outputs the password hash which is "1ac30ef9e714fff0ab12b398e379f358".

I want it to output the word "Cricket". How can I get it to output the password word itself and not the password hash?

Community
  • 1
  • 1
user1394925
  • 754
  • 9
  • 28
  • 51

7 Answers7

4

The point of a hash is that it is one-way. It is different from an encryption, which is two-way.

You can not un-hash something.

http://en.wikipedia.org/wiki/MD5

2

That is not possible, a hash prevents that. A hashing algorithmus shorts a anyhow long input to a constant length output. it is not possible to make that backwards.

Inside a normal hashing algorithmus is the modulo operator used which reduces the information count. A information which was removed cannot be recovered. But it is possible to get the password back by using a so called rainbow table. But note that this is much more complex if a salt is used.

rekire
  • 47,260
  • 30
  • 167
  • 264
1

If you want to verify if the user entered the correct password... also hash the entered value and match both hashes ;-).

Najzero
  • 3,164
  • 18
  • 18
1

Hashes are used instead of encrypted passwords to make it impossible for anyone else to get at someone's password, including a system administrator. You can match the hash, but you cannot retrieve the original password from it.

That's a feature. It makes for better security, since the only person who has access to the original password is the individual who created it.

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
0

Hashes are a one-way encryption. There is no way to get the password from the hash.

Emil Vikström
  • 90,431
  • 16
  • 141
  • 175
0

You can make a dictionary where you have some words and generated hashes, but the general notion of hashing is that it is computationally difficult to extract the original word

MayTheSchwartzBeWithYou
  • 1,181
  • 1
  • 16
  • 32
0

Is it impossible to output the MD5 hash. MD5 is one way only. If you want the password, you have to set a new one. Or use 'John the ripper' to crack it...

Green Black
  • 5,037
  • 1
  • 17
  • 29