Register now and start sharing your code snippets.
-->

Generate a 56-bit DES encrypted (htpasswd) password with Ruby

CSS posted 12 months ago by christian

Run the following in an irb console to generate a 56-bit DES encrypted password:

   1  "password".crypt("salt")

The password can be used in an Apache or Nginx htpasswd file to enable basic authentication.

The generated password can also be used in other Unix password files.

Tagged ruby, irb, htpasswd, nginx, apache