in reply to MD5 and my Win32 Apache

Just do a system call or use back tics to call htpasswd.exe and save yourself the grief...

`$HTPASSWD_BIN -b $HTPASSWD_FILE $user "$pwd"`;

Where $HTPASSWD_BIN is the full path to htpasswd.exe and $HTPASSWD_FILE is the full path to the .htpasswd file.

If you want to see why what you are trying to do will not work properly read this (from the docs for Win32):

htpasswd encrypts passwords using either a version of MD5 modified for Apache, or the system's crypt() routine. Files managed by htpasswd may contain both types of passwords; some user records may have MD5-encrypted passwords while others in the same file may have passwords encrypted with crypt().

And then read htpasswd.c which you will find in your distro if you do a search. The MD5 hashing is modified as you can see. You may be able to use crypt() to do what you want if you don't want to go the system call route for some reason.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: MD5 and my Win32 Apache
by cdguitar01 (Monk) on Jan 02, 2003 at 03:57 UTC
    Thanks tachyon, I'm going go and see if I'm advanced enough yet to make your solution work. I don't see why it wouldn't so, thanks.

    Chris DeGrace
    cdguitar01