0

I have a password stored in the database and it's showing in browser as md5 because it's saved there as md5

below is the code am using

$result=$link->query("select * from adminpanel");
 
echo "<tr><th>User Name</th><th>Password</th></tr>";
 
// loop through results of database query, displaying them in the table
 
while($row =mysqli_fetch_array($result,MYSQLI_ASSOC)) {
// foreach( $result as $row ) { 
 

 
// echo out the contents of each row into a table
 
echo "<tr>";
 
echo '<td>' . $row['username'] . '</td>';
 
echo '<td>' . $row['password'] . '</td>';

It is showing me the user name and password in a table against each user but the password I want to show in ENGLISH. Is it possible?

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • 3
    One does not simply want to show decrypted passwords? – Deepak Apr 11 '17 at 07:58
  • Not possible while you're storing the password in md5 - it's kind of the point really. You could store the password in another format than can be decrypted - but that would be insecure and pretty poor form. – Tom Apr 11 '17 at 07:59
  • first of all why are you using md5 for hashing it's deprecated and not use by developers anymore. – Shahroze Nawaz Apr 11 '17 at 08:05
  • Don't want to sound like a smartass, but you do not want to store your passwords as md5 hashes, use `password_hash`, [http://php.net/manual/en/function.password-hash.php](http://php.net/manual/en/function.password-hash.php). MD5 is a one way hash, but not a very strong one. And please don't ever store passwords in clear text for any reason. – mazedlx Apr 11 '17 at 08:11

3 Answers3

0

md5 is a hash; you can't "undo" an md5 encryption

RomMer
  • 909
  • 1
  • 8
  • 19
0

MD5 is a cryptographic hash function. The very point of these functions is that you cannot reverse them. That is: you cannot "decrypt" the password from the MD5 sum.

The way these are used for passwords is to hash the password that the user entered and compare that hash with the one you stored in your database. But MD5 is actually not well-suited for this, as you can easily get a password that produces the same hash using a rainbow table. At least add some salt.

DarkDust
  • 90,870
  • 19
  • 190
  • 224
0

Hashing is a one-way operation, meaning it cannot be decrypted. Simply you can not decrypt the MD5 encrypted value. If in your case you need it then you can use any other two-way operation for password.