Crypt::verifyPassword()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Faulancer\Security;
4
5
/**
6
 * Class Crypt
7
 * @package Faulancer\Security
8
 * @author  Florian Knapp <[email protected]>
9
 */
10
class Crypt
11
{
12
13
    /**
14
     * Generate a hashed password string
15
     *
16
     * @param string $password
17
     *
18
     * @return bool|string
19
     *
20
     * @throws \Exception
21
     */
22
    public static function hashPassword(string $password) :string
23
    {
24
        return password_hash($password, CRYPT_BLOWFISH);
25
    }
26
27
    /**
28
     * Verify a password
29
     *
30
     * @param string $password
31
     * @param string $hash
32
     *
33
     * @return bool
34
     */
35
    public static function verifyPassword(string $password, string $hash) :bool
36
    {
37
        return password_verify($password, $hash);
38
    }
39
40
}