Jump to content

md5 password


nathanmaxsonadil

Recommended Posts

is this enough?

$_POST['username'] = mysql_real_escape_string($_POST['username']);
$_POST['email'] = mysql_real_escape_string($_POST['email']);
$_POST['password'] = mysql_real_escape_string($_POST['password']);
$_POST['password2'] = mysql_real_escape_string($_POST['password2']);
$_POST['hidden'] = mysql_real_escape_string($_POST['hidden']);
$_POST['username'] = htmlentities($_POST['username']);
$_POST['email'] = htmlentities($_POST['email']);
$_POST['password'] = htmlentities($_POST['password']);
$_POST['password2'] = htmlentities($_POST['password2']);
$_POST['hidden'] = htmlentities($_POST['hidden']);

Link to comment
Share on other sites

I'd also suggest salting md5 passwords. That basically means adding on a bogus string to it before hashing. While you are most likely still safe just using md5 there are dictionaries that include md5 hashes for what might be considered more common words.

Link to comment
Share on other sites

Just in case, you should also strip_tags it ( http://ca.php.net/manual/en/function.strip-tags.php )

 

$name = strip_tags($name);

 

Also, for a maximum protection, use sha1() instead of md5()

 

$pass = sha1($pass);

 

Then, to authenticate, verify if it matches the one in the database :

 

if (sha1($_POST[pass]) === $database_pass)

    {...}

else

    {...}

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.