I am creating website with login. I have salted hash of password, my question is - Is it better to create hash in php, or is it better to create it within sql query?
SQL
INSERT INTO users (USER, PASS) VALUES ("foo",SHA1( CONCAT( "salt", MD5( 123456 ) ) ) )
PHP
$pass = sha1( "salt" . md5( 123456 ) );
$link->query("INSERT INTO users (USER, PASS) VALUES ("foo","$pass");
And its not only about creating user, it could be checking when signing in.
The thing is, I've heard that everything that happens in database is quicker than in php, but I am afraid to send sql with clearly visible password (security reasons).