Sha1PasswordHasher   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 2
c 1
b 0
f 0
dl 0
loc 12
ccs 2
cts 2
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A callHashFunction() 0 3 1
1
<?php
2
3
/**
4
 * Copyright (c) Phauthentic (https://github.com/Phauthentic)
5
 *
6
 * Licensed under The MIT License
7
 * For full copyright and license information, please see the LICENSE.txt
8
 * Redistributions of files must retain the above copyright notice.
9
 *
10
 * @copyright     Copyright (c) Phauthentic (https://github.com/Phauthentic)
11
 * @link          https://github.com/Phauthentic
12
 * @license       https://opensource.org/licenses/mit-license.php MIT License
13
 */
14
15
declare(strict_types=1);
16
17
namespace Phauthentic\PasswordHasher;
18
19
/**
20
 * Sha1 Password Hasher
21
 *
22
 * WARNING: This is UNSAFE and should NOT be used anymore!!! sha1 has been
23
 * compromised! It is no longer a secure hash algorythm!
24
 *
25
 * This hasher just exists for legacy reasons and is thought to be used with
26
 * the Fallback hasher, to update the passwords transparently to a secure hash.
27
 *
28
 * @link http://php.net/manual/en/function.sha1.php
29
 */
30
class Sha1PasswordHasher extends Md5PasswordHasher
31
{
32
    /**
33
     * Calls the actual php method that will do the hashing
34
     *
35
     * @link http://php.net/manual/en/function.sha1.php
36
     * @param string $password Password string
37
     * @return string
38
     */
39 4
    protected function callHashFunction(string $password): string
40
    {
41 4
        return sha1($password, $this->rawOutput);
42
    }
43
}
44