54 public function crypt( $password ) {
55 if ( !defined(
'CRYPT_BLOWFISH' ) ) {
56 throw new MWException(
'Bcrypt is not supported.' );
63 if ( !isset( $this->args[0] ) ) {
64 $this->args[] = substr(
68 base64_encode( random_bytes( 16 ) ),
76 sprintf(
'$2y$%02d$%s', (
int)$this->params[
'rounds'], $this->args[0] ) );
78 if ( !is_string(
$hash ) || strlen(
$hash ) <= 13 ) {
84 $this->params[
'rounds'] = (int)$parts[0];
85 $this->args[0] = substr( $parts[1], 0, 22 );
86 $this->hash = substr( $parts[1], 22 );