Jump to content

[SOLVED] md5 decrypt


perezf

Recommended Posts

I made this script where it shows the users their details, now how would i show them their password decrypted

<?php

session_start();
if(!session_is_registered('username')) {
	header("Location: http://localhost/practice.com/?page=log-on");
}

$sessionid = $_SESSION['username'];
$query = "SELECT * FROM ph_users WHERE username = '$sessionid'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);

?>

<p>You can View Your Infomation Below:</p>
<p>Your UserName: <?php echo $row['username']; ?></p>
<p>Your Password: <?php echo $row['password']; ?></p>
<p>Your Name: <?php echo $row['fullname']; ?></p>
<p>Your Profile:<br><?php echo $row['profile']; ?></p>
<p>Your Email Address: <?php echo $row['email']; ?></p>
<p><a href="?page=logout">LogOut</a></p>

 

 

right now it shows the password in md5

Link to comment
Share on other sites

<?php

if (isset($_GET['password'])){
$password = $_GET['password'];
$password_length = strlen($password);
}
else
{
$password_length = 3;
if (isset($_GET['length'])){
$password_length = $_GET['length'];}
$password = randomkeys($password_length);
}

echo "Password is: $password <br />";
$password = md5($password);
$attempts = 0;
$start = microtime(true); 
while ($password != $guess){
$guess = md5(randomkeys($password_length));
$attempts++;
}
$end = microtime(true);
$time = $end-$start;
echo "Password guessed correctly after $attempts attempts and $time seconds";?>

Link to comment
Share on other sites

Well showing the password would be considered a security risk, what happens if they stay logged in?

 

If you really want to show it, make another field in your MySQL table which has all their real passwords next to their md5 ones, but still this is considered a security risk.

Link to comment
Share on other sites

lol darkfreaks, thats pretty off topic.

 

as previously said, md5 is a one way, 128-bit hashing algorithm. Theres not way of returning the original value.

 

If you really want to show it, make another field in your MySQL table which has all their real passwords next to their md5 ones, but still this is considered a security risk.

 

Then why md5 it when an attacker can find the other table.

Link to comment
Share on other sites

I made this script where it shows the users their details, now how would i show them their password decrypted

<?php

session_start();
if(!session_is_registered('username')) {
	header("Location: http://localhost/practice.com/?page=log-on");
}

$sessionid = $_SESSION['username'];
$query = "SELECT * FROM ph_users WHERE username = '$sessionid'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);

?>

<p>You can View Your Infomation Below:</p>
<p>Your UserName: <?php echo $row['username']; ?></p>
<p>Your Password: <?php echo $row['password']; ?></p>
<p>Your Name: <?php echo $row['fullname']; ?></p>
<p>Your Profile:<br><?php echo $row['profile']; ?></p>
<p>Your Email Address: <?php echo $row['email']; ?></p>
<p><a href="?page=logout">LogOut</a></p>

 

 

right now it shows the password in md5

The ONLY reason to put the passwords in MD5 in the first place is so that they cannot be retrieved.

If you want it to be possible to retrieve the passwords, then don't change them to MD5.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.