Deon George 6f63726606
All checks were successful
Create Docker Image / Test Application (x86_64) (push) Successful in 27s
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 1m19s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 4m32s
Create Docker Image / Final Docker Image Manifest (push) Successful in 8s
Fix for ARGON2 passwords, they shouldnt be base64 encoded. Fixes #316
2025-05-03 23:37:32 +10:00

25 lines
603 B
PHP

<?php
namespace App\Classes\LDAP\Attribute\Password;
final class Argon2i extends Base
{
public const key = 'ARGON2';
protected const subkey = 'argon2i';
protected const identifier = '$argon2i';
public static function subid(string $password): bool
{
return str_starts_with(self::password($password),self::identifier.'$');
}
public function compare(string $source,string $compare): bool
{
return password_verify($compare,$this->password($source));
}
public function encode(string $password): string
{
return sprintf('{%s}%s',self::key,password_hash($password,PASSWORD_ARGON2I));
}
}