| 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 Argon2idHash extends AbstractArgon2Hash |
| 20: | { |
| 21: | |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | |
| 30: | public function __construct(Algorithm $algorithm, array $options = []) |
| 31: | { |
| 32: | if (Algorithm::Argon2id !== $algorithm) { |
| 33: | throw new HashException(\sprintf( |
| 34: | 'Algorithm expected to be Algorithm::Argon2id, Algorithm::%s given.', |
| 35: | $algorithm->name, |
| 36: | )); |
| 37: | } |
| 38: | |
| 39: | parent::__construct($algorithm, $options); |
| 40: | } |
| 41: | |
| 42: | #[\Override] |
| 43: | public function valid(): bool |
| 44: | { |
| 45: | return \defined('PASSWORD_ARGON2ID'); |
| 46: | } |
| 47: | } |
| 48: | |