Create a .htpasswd password

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

Username

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

Password

Enter the password


Type of .htpasswd entry to be created:

  OR  


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

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

   $random=rand();        
// 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);
   $salt=substr($salt,0,2);
// Just in case

   return($salt);
   }

© Iain Begg