Add encrypted passwords to database

When creating a user sign up form how do I send the password value to the databse (mySQL) encrypted?

Is this set up in the database structure or on the php page sending the info from the form?
BrighteyesDesignAsked:
Who is Participating?
 
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
example of mysql encryption:
INSERT into user (first_name, address) VALUES (AES_ENCRYPT('Obama', 'usa2010'),AES_ENCRYPT('Obama', 'usa2010'))

Open in new window



example of php encryption:
<?php
$pwd= "123456";
echo md5($pwd);
?>

Open in new window

0
 
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
0
 
Marco GasiConnect With a Mentor FreelancerCommented:
A very basic function looks like this one:

?>
<?php
$salt = "SOMEWORD";
$password_hash = md5($salt . md5($_POST['password'] . $salt));
?>

Cheers
0
 
Marco GasiFreelancerCommented:
You can find something more sophisticated but easy to implement here: http://www.richardlord.net/blog/php-password-security
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.