Passed
Push — master ( 25ba62...8b27c8 )
by Aimeos
04:58
created

Standard::hash()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2021
6
 * @package MW
7
 * @subpackage Password
8
 */
9
10
11
namespace Aimeos\MW\Password;
12
13
14
/**
15
 * Standard implementation of the password helper
16
 *
17
 * @package MW
18
 * @subpackage Password
19
 */
20
class Standard implements \Aimeos\MW\Password\Iface
21
{
22
	/**
23
	 * Returns the hashed password
24
	 *
25
	 * @param string $password Clear text password string
26
	 * @return string Hashed password
27
	 */
28
	public function hash( string $password ) : string
29
	{
30
		return password_hash( $password, PASSWORD_DEFAULT );
31
	}
32
33
34
	/**
35
	 * Verifies the password
36
	 *
37
	 * @param string $password Clear text password string
38
	 * @param string $hash Hashed password
39
	 * @return bool TRUE if password and hash match
40
	 */
41
	public function verify( string $password, string $hash ) : bool
42
	{
43
		return password_verify( $password, $hash );
44
	}
45
}
46