View Single Post
Old 06-21-2002, 11:08 AM  
Jinn
Confirmed User
 
Join Date: Nov 2001
Posts: 72
htpasswd / encryption question

Hello everyone:

I am sure there are a lot of programmers, unix gurus here, so I hope someone can help me.

I am wondering how the passwords are encrypted in the htpasswd file. I want to use PHP to do the authentication job by reading in the htpasswd file and comparing the input password with the one in the file. But I don't know how to generate the encrypted password with php.

I was trying to use the first 2 characters of the password as salt, then do crypt() in php. But it doesn't work in most cases. I am using Globill and ccBill and both write to the same htpasswd file. I noticed that (at least for ccBill) different encrypted passwords in htpasswd file can be generated from the same original password at different time. Is this normal? How Apache get to know the method they were encrypted? Can PHP do the same job? I am very new to this topic. So please, please help me. Thank you very much!

Any information would be very appreciated!

Jinn
Jinn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote