Why will this password hash and compare not work?
<p>The way I am hashing the password and inserting values into the database,</p>

<pre><code>$q = $dbc -&gt; prepare("INSERT INTO accounts (username, email, password, type, gender, joined)
                      VALUES (?, ?, ?, ?, ?, ?)");
$q -&gt; execute(array($_POST['username'], $_POST['email'], 
                    hash('sha256', $_POST['password'] . date('y/m/d')), 
                    $_POST['type'], $_POST['gender'], date('y/m/d')));
</code></pre>

<p>When I compare then like this,</p>

<pre><code>if ($count == 1 
&amp;&amp; $info['password'] === hash('sha256', $_POST['password'].$info['joined'])
&amp;&amp; $info['logcount'] != -1)
</code></pre>

<p>Both the hashes work but throw out different values? I am using the exact same formula for creating and comparing.</p>

<p>I am taking the user password, salting it with the current date, then hashing, both values are stored in the database and on comparison doing the exact same thing, all the tutorials online are all about hashing and creating secure hashes, not comparing.</p>

<p>Thanks</p>
