On Wed, 14 Nov 2001, Taymour A. El Erian wrote:
=>Hi,
=> I know this is a bit out off topic, but I hope somebody can help me or
=>direct me to the right place.
=>I am designing a web interface for free mail registration using
=>qmail-ldap. The interface is written in PHP4 and I am having trouble
=>with the MD5 hash (since I am using MD5 for the passwords) and using the
=>following code
=>$info["userPassword"]="{MD5}" . base64_encode("MD5".md5($password));
=>I found other code using mhas instead of md5 is there a difference
=>because this code does not give the correct password.
Well, yes, it's off topic. This is more for the lists related to PHP.
Anyhow, I will answer it here as I approached it yesterday myself.
*head exploding into tiny pieces*
Now, the {MD5} password crypt is different from the md5() function of
PHP4. The {MD5} password crypt uses a digest method, not a check sum
method.
The mhash functions are what you're looking for, to compute an MD5 digest
and not the md5 checksum.. You can also use the SHA1 or other methods with
mhash, which may be something you want to use in future.
Of course, if setting new passwords, you can always use {crypt} :>
--
| Stephen "Slepp" Olesen / VE6SLP
| Edmonton, Alberta, Canada / (780) 425-4798
| President of Geeks Anonymous + http://www.geeksanon.ca/
+---------------------------------