...

View Full Version : php-md5 encyption-mysql



amcf1992
09-14-2011, 11:08 PM
When a user registers on my site, I encrypt their data using md5, now I want to welcome the user with some of their stats,

firstname
lastname

But when I retrieve their data from the db, it appear as a md5 hash string
How can I un-md5 data when I retrieve it from the db


<?php session_start(); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Account Dashboard</title>
</head>
<body>
<?php
include('dbsettings.php');

$con = mysql_connect("$host","$user","$password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("$db_name", $con);

$result = mysql_query("SELECT * FROM $tbl_name");

while($row = mysql_fetch_array($result))
{
echo $row['firstname'] . " " . $row['lastname'];
echo "<br />";
}

mysql_close($con);
?>
<a href="logout.php"> Log Out </a>
</body>
</html>

Fou-Lu
09-14-2011, 11:21 PM
MD5 is a hashing algorithm, not an encryption algorithm, so you cannot reverse it. Its also an insecure one at that.
The only thing you should be hashing is a password, and I'd recommend using sha256 or sha512 for that at the moment.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum