Can I hash a database password in a PHP class?

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Can I hash a database password in a PHP class?

Post by JAB Creations »

I just tried the following...

Code: Select all

$username = $my_db->give('username');
$password = $my_db->give('password');
$hostname = "localhost";    
$dbh = mysql_connect($hostname, $username, $password) or exit($dbip = "0");
That seems pretty nifty however is there a way I can encrypt/hash a password? If so how would I need to modify the code?
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Re: Can I hash a database password in a PHP class?

Post by Mordred »

No, you can't.
Post Reply