If your intent is to write a PHP script which will allow you to manage Apache permissions, I recommend that, if available, you invoke the htpasswd application externally.
Apache's authentication system uses either the system's crypt() function (if available) or a modified version of MD5.
ok, i think that will be best if i can get it too work. I was running htpasswd on the command line, with -b and -c, passing the username and password. Looks like the pw file is created correctly, and my .htaccess file looks fine, but it doesn't like any passwords. Any idea?
Sure it is. Unix crypt() and md5() are both one way hash functions. In fact, many linux distributions use md5 checksums for their system password hashes, it allows you to use longer passwords securely.
unix crypt() is one-way and cannot be decrypted. It as a misnomer because it is not an encryption, but a hashing algorithm.
The method to authenticate is to take the password the user offers, crypt or md5 it and compare it to the stored hash.
Whoever told you not to use md5 probably didn't know what they were talking about. md5 is actually better than crypt because the probability of a hash collision (two passwords having the same hash value) is orders of magnitude smaller.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.