X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2Fpassword%2FPbkdf2Password.php;h=4a8831e32f1e2d8a5e44968aeff1ba20fe04cdc3;hb=689c847a32e7fe8a0b3a559a88a627a252c5018e;hp=6ffada36b4c66090d0ebb7456aaac6acd364168f;hpb=b6e954a1629f28024d30a8e2575fb6de977b5e00;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/password/Pbkdf2Password.php b/includes/password/Pbkdf2Password.php index 6ffada36b4..4a8831e32f 100644 --- a/includes/password/Pbkdf2Password.php +++ b/includes/password/Pbkdf2Password.php @@ -41,12 +41,17 @@ class Pbkdf2Password extends ParameterizedPassword { return ':'; } + protected function shouldUseHashExtension() { + return isset( $this->config['use-hash-extension'] ) ? + $this->config['use-hash-extension'] : function_exists( 'hash_pbkdf2' ); + } + public function crypt( $password ) { if ( count( $this->args ) == 0 ) { $this->args[] = base64_encode( MWCryptRand::generate( 16, true ) ); } - if ( function_exists( 'hash_pbkdf2' ) ) { + if ( $this->shouldUseHashExtension() ) { $hash = hash_pbkdf2( $this->params['algo'], $password,