Create a .htpasswd password

Use the .htpasswd generator to create passwords for .htpasswd files -
to MD5 or APR1-MD5 encryption.


Enter the username you would like to add to your .htpasswd file


Enter the password

Type of .htpasswd entry to be created:


The method used in PHP to generate the MD5 encrypted password:

$salt = genSalt();
$password1 = crypt($password, $salt)
function genSalt () {
   $random = 0;
   $rand64 = "";
   $salt = "";

// Seeded via initialize()

// Crypt(3) can only handle A-Z a-z
   $rand64= "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
   $salt=substr($rand64,$random % 64,1).substr($rand64,($random/64) % 64,1);
// Just in case


© Iain Begg