Revising my "question" so as not to rustle the natives.
It seems there are so many resources around the internet these days (SO included) that finding "an" answer to a question may be easy, but how to tell if that answer is valid or even up to date?
One area in particular and one that gets asked a lot is how to deal with hashing and encryption properly with PHP for preparation in database storage. One common answer on SO always seems to be "Have you visited php.net yet?". While I understand this typically comes to a question in which somebody asks the simplest of questions, I have started to find some of the descriptions seem to conflict and more importantly, the user examples are outdated (a lot from 2008-2009).
For example: when seeking why and how to use password hashing: http://www.php.net/manual/en/faq.passwords.php#faq.passwords.fasthash
In summary, I learn that sha1 and md5 are fast and computationally efficient methods of hasing, they are no longer suitable for password hashing. The suggested method is to use the crypt() function.
When learning more about crypt() and in particular blowfish hashing, the rules stated on the page are as follows:
http://www.php.net/manual/en/function.crypt.php
- start my salt with $2a$
- continue with two numeric values (user below has stated the significance of this whereas php.net does not)
- follow with a $
- enter 22 alpha-numeric characters
Further reading gives an example of:
<?php
if (CRYPT_BLOWFISH == 1) {
echo 'Blowfish: ' . crypt('rasmuslerdorf', '$2a$07$usesomesillystringforsalt$') . "\n";
}
?>
It seems the example on the same page does not follow the rules it just told us to use (26 characters after "$2a$07$".
The return has is:
Blowfish:
$2a$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi
essentially, the string itself does in fact get altered but nearly my entire SALT value (the first 22 characters mentioned above) is sitting wide open. Wouldn't this make it somewhat simpler to determine what my actual string was?
More importantly, this is only one example but ultimately, how heavily should resources such as PHP.net be relied upon?
As my friend Mugatu once said "I feel like I'm taking crazy pills".
Note: the pages mentioned above were edited since my original posting so I cannot guarantee things have not changed since my original question and examples provided.