I'm currently having some trouble getting a login system to work and I believe I have found the reason why, though I have no idea why it is happening or what specifically is causing it.
I have a hashed password stored in a database. The value of the password
column is:
18e2acd33fd3ec752c344b463d00238e35b6b77ed65941f69b9eb96471834f1e507d846071768548f8cf125d6c74ce614d477a576657983bb8620bbc49eed7de
Now when I go to simply select and print that field in PHP like so:
$query = "SELECT password FROM webusers WHERE username = 'Roy'";
$update = odbc_exec($connect, $query);
$row = odbc_fetch_array($update);
print $row['PASSWORD'];
It outputs:
18e2acd33fd3ec752c344b463d00238e35b6b77ed65941f69b9eb96471834f1e507d846071768548f8cf125d6c74ce614d477a576657983bb8620bbc49eed7d
Scroll to the very end of both hashes and you'll see the second hash is missing a final 'e' and so this is throwing off my entire login system. Why would this be happening? I'm not sure whether PHP or SQL is to blame.
I'm using PHP 5.4.7 and the database is a 4D SQL server connected via ODBC.
Edit: The datatype of password
is Text
which, according to 4D's manual, can hold up to 2GB of data so the column size is not the issue.