= 128) throw new Exception (dgettext ("domframework", "Invalid password provided : too long"), 500); return true; } /** Crypt the password with the best algorithm available * @param string $password The password to crypt */ public function cryptPasswd ($password) { if (! function_exists ("openssl_random_pseudo_bytes")) throw new Exception (dgettext ("domframework", "No PHP support for openssl_random_pseudo_bytes"), 500); $cost = 11; $salt = substr (base64_encode (openssl_random_pseudo_bytes (17)), 0, 22); $salt = str_replace ("+", ".", $salt); $param = '$'.implode ('$', array( "2y", //select the most secure version of blowfish (>=PHP 5.3.7) str_pad ($cost, 2, "0", STR_PAD_LEFT), //add the cost in two digits $salt //add the salt )); //now do the actual hashing return crypt ($password, $param); } /** Check if the password is enough complex * Return True if the password is enough complex * @param string $password The password to check */ public function passwdComplexity ($password) { } }