I have done a lot of googling and whatnot and cannot find what I am looking for ...
I am working on tightening authentication for my site. I decided to take the user credentials, and the hash / salt from them. Then save these values in the database and in the user's cookies. I changed the script I found on the PHP website and it has been working fine so far. However, I noticed that when using array_rand it sequentially selects characters from a predefined string. I did not like this, so I decided to use shuffle in the array_rand'd array. It works great.
Further! I thought it would be wise to turn the password entered by the user into an array, and then combine it with my salt array! Well, I can’t turn the user password into an array. I want each character in their password to be an array entry. IE, if your password was "cool", the array would be, Array 0 => c 1 => o 2 => o 3 => l, etc. Etc. I tried a word to break a string and then explode it using the specified interrupt character, which did not work. I suppose I could do something with a for, strlen loop, and much more, but there should be a more elegant way.
Any suggestions? I am somehow at an impasse :( That's what I still have, I have not done this because I have not advanced any further than the explodey part.
$strings = wordwrap($string, 1, "|");
echo $strings . "<br />";
$stringe = explode("|", $strings, 1);
print_r($stringe);
echo "<br />";
echo "This is the exploded password string, for mixing with salt.<hr />";
Thank you very much:)
Shawn source
share