Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

htpasswd 1

Status
Not open for further replies.

petermeachem

Programmer
Aug 26, 2000
2,270
GB
I've got to generate a lot of these. I understand it is encrypted using md5, but I don't know if there are any other rules in force.
Does anyone know where I can find vb code to do this?
 
Getting nowhere fast with this. I can't find any code. I thought I could use the htpasswd.exe installed when I put apache on my computer some while back, but I get wildly different results compared to a 'create a password' web page.
aaaa:YWpFRA3nu4UOs
aaaa:$apr1$Gb......$MF0DPlu9/a8GXTmzJOWyF0

The first is from the web page, the second from 'my' copy of htpasswd.exe

Any help at all appreciated!
 
MD5 is a digest or hash algorithm, not encryption.

I seem to recall successfully converting the Javascript one from to VB6 but I don't have it handy right now. You might search the web or convert this one yourself.

I'll dig through my archives later in case you don't get an answer soon.
 
I thought I could use the htpasswd.exe installed when I put apache on my computer some while back, but I get wildly different results compared to a 'create a password' web page

I too use the htpasswd.exe that comes with Apache. If you are going to use these on an Apache server then you should be OK.

from
The MD5 algorithm used by htpasswd is specific to the Apache software; passwords encrypted using it will not be usable with other Web servers.

I have, however, found that Python's sha module outputs the same hash as "htpasswd.exe -s".
I know I've downloaded VB code for hashing some months ago.
Will try to find it and check if it outputs the same hash as Python.
 
posted too soon
cited code produces same output as Python's
Code:
sha.new('value').hexdigest()
output of "htpasswd.exe -s", however, is same as Python's
Code:
base64.encodestring(sha.new('value').digest())
will need more work to get VB code to output the same
 
Justin, that is fantastic, thankyou so much. I'll try the htpasswd.exe sha output on the web server and see if it is ok.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top