Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to generate this kind of hashes programmatically:


But I can't identify what kind of hash it is. The hash comes from a .htpasswd file.

All the online htpasswd generators I tried generates different type of hashes.

share|improve this question
up vote 10 down vote accepted

It's CRYPT encryption - an old default. You should probably use MD5 or SHA instead - see man htpasswd for more information.

How are you trying to generate your passwords? You could run htpasswd -n -b username password, but most languages probably have a library function for that already.

Perl example:

perl -e 'print crypt("passwordgoeshere","salt") . "\n"'

The second parameter is the salt. As Gerard points out it's better to use a random string as salt.

share|improve this answer
This is REALLY insecure. Part of your unencrypted password will show up in the returned digest (in this case it's the "pa" in "papAq5PwY/QQM"). You should use random characters instead: – Gerald Combs May 12 '11 at 19:28
I missed that! Thanks @Gerald. – Eduardo Ivanec May 12 '11 at 19:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.