1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | namespace Nexus\Password\Hash; |
15: | |
16: | use Nexus\Password\Algorithm; |
17: | use Nexus\Password\HashException; |
18: | |
19: | final readonly class Argon2iHash extends AbstractArgon2Hash |
20: | { |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | |
28: | |
29: | |
30: | public function __construct(Algorithm $algorithm, array $options = []) |
31: | { |
32: | if (Algorithm::Argon2i !== $algorithm) { |
33: | throw new HashException(\sprintf( |
34: | 'Algorithm expected to be Algorithm::Argon2i, Algorithm::%s given.', |
35: | $algorithm->name, |
36: | )); |
37: | } |
38: | |
39: | parent::__construct($algorithm, $options); |
40: | } |
41: | |
42: | public function valid(): bool |
43: | { |
44: | return \defined('PASSWORD_ARGON2I'); |
45: | } |
46: | } |
47: | |