Password handling with MD5 and CRYPT isn't working as expected : <p>What I am trying to do is self explanatory:
I get a "username" and a "password" set by a user, and try to encrypt it.</p>

<p>Here's what I've tried so far:</p>

<pre><code>//Firstly i recieve user and pswd
$usua=SQLite3::escapeString($_POST['usuario']);
$psw=SQLite3::escapeString($_POST['psw']);

//Then i proceed to encrypt
$key = md5('firstWord');
$salt = md5('secondWord');

function hashword($string,$salt){
    $string= crypt($string, '$1$'.$salt.'$');    
}

$psw = hashword($psw, $salt);
</code></pre>

<p>Some how this code always returns the same result: "$1$7b77d82".</p>

<p>What's wrong?</p>

<p>How would you do this? </p>

<p>Should i use Bcrypt? </p>

<p>Clearly this process should return different values for each password used but it doesn't.</p>
