public static function generatePassword($password, $type = 'md5')
	{
		switch (strtolower($type))
		{
			case 'sha':
				$userpassword = '{SHA}' . base64_encode(pack('H*', sha1($password)));
				break;

			case 'md5':
			default:
				$userpassword = '{MD5}' . base64_encode(pack('H*', md5($password)));
				break;
		}

		return $userpassword;
	}
public static function generatePassword($password, $type = 'md5')
	{
		switch (strtolower($type))
		{
			case 'sha':
				$userpassword = '{SHA}' . base64_encode(pack('H*', sha1($password)));
				break;

			case 'md5':
			default:
				$userpassword = '{MD5}' . base64_encode(pack('H*', md5($password)));
				break;
		}

		return $userpassword;
	}
public static function generatePassword ( $ password , $ type = 'md5' ) { switch ( strtolower ( $ type ) ) { case 'sha' : $ userpassword = '{SHA}' . base64_encode ( pack ( 'H*' , sha1 ( $ password ) ) ) ; break ; case 'md5' : default : $ userpassword = '{MD5}' . base64_encode ( pack ( 'H*' , md5 ( $ password ) ) ) ; break ; } return $ userpassword ; }
Generates a LDAP compatible password

@param   string  $password  Clear text password to encrypt
@param   string  $type      Type of password hash, either md5 or SHA

@return  string   Encrypted password

@since   1.0
Generates a LDAP compatible password