X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fpassword%2FPbkdf2Password.php;h=4a8831e32f1e2d8a5e44968aeff1ba20fe04cdc3;hb=a9911b2582a20d9fe0569439d0d22a8c3135c249;hp=6ffada36b4c66090d0ebb7456aaac6acd364168f;hpb=b87a4fba8a27fc1c683a01560c6d932acfd07ce6;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,