On Wed, Jan 14, 2009 at 6:17 PM, tedd <tedd.sperling@xxxxxxxxx> wrote: > At 2:19 PM -0600 1/14/09, Shawn McKenzie wrote: >> >> >> As others have said, use crypt(). >> http://php.net/manual/function.crypt.php has Example #2 Using crypt() >> with htpasswd. > > > Thanks, but that doesn't really solve my problem. > > You see, I know the password and I know the encoded result -- what I don't > know is what algorithm was used to generate the encoding. I didn't get that from your original post at all. You asked how to "create an encoded password string that would work in a .htaccess file using basic authentication." The crypt() function should do that. Have you tried creating a hash for a new password using crypt() and the function output into your .htaccess file? (Not comparing a known password to a known hash; just testing whether a hash that crypt() generates will work for your authentication.) > Here are all the algorithms I know of (this includes the above link you > provided). > > http://webbytedd.com/bbbb/md5/index.php > > However, none of them match what have. > > Cheers, > > tedd This looks like a totally different question from your original post. Are you saying that you already have values in the .htaccess file that don't match what you expect when you run the known passwords through crypt()? What do you get when you try this? <?php if (crypt($password, $known_hash) == $known_hash) { echo 'Authenticated'; } else { echo 'Not Authenticated'; } ?> It's been a while since I've used this, but I'm pretty sure it works regardless of the algorithm selected (internally) by the crypt() function. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php