Debian Codegraph @

includes/password/Pbkdf2PasswordUsingHashExtension.php

raw symbols SCIP
1 <?php
2 /**
3 * Implements the Pbkdf2PasswordUsingHashExtension class for the MediaWiki software.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 */
22
23 declare( strict_types = 1 );
24
25 namespace MediaWiki\Password;
26
27 /**
28 * A PBKDF2-hashed password, using PHP's hash extension
29 *
30 * This class exists for compatibility purposes only! Unless an installation's
31 * existing password hashes were generated using an algorithm not supported by
32 * OpenSSL, Pbkdf2PasswordUsingOpenSSL should be used.
33 *
34 * @since 1.40 (since 1.29 under the old name)
35 */
36 class Pbkdf2PasswordUsingHashExtension extends AbstractPbkdf2Password {
37 protected function getDigestAlgo( string $algo ): ?string {
38 return in_array( $algo, hash_hmac_algos(), true ) ? $algo : null;
39 }
40
41 protected function pbkdf2(
42 string $digestAlgo,
43 string $password,
44 string $salt,
45 int $rounds,
46 int $length
47 ): string {
48 return hash_pbkdf2( $digestAlgo, $password, $salt, $rounds, $length, true );
49 }
50 }
51
52 /** @deprecated class alias since 1.40; use MediaWiki\\Password\\Pbkdf2PasswordUsingHashExtension */
53 class_alias( Pbkdf2PasswordUsingHashExtension::class, 'Pbkdf2Password' );
54
55 /** @deprecated since 1.43 use MediaWiki\\Password\\Pbkdf2PasswordUsingHashExtension */
56 class_alias( Pbkdf2PasswordUsingHashExtension::class, 'Pbkdf2PasswordUsingHashExtension' );