Fix for ARGON2 passwords, they shouldnt be base64 encoded. Fixes #316

This commit is contained in:
Deon George 2025-05-03 23:37:32 +10:00
parent 75dbb37d8b
commit f8d7819153
2 changed files with 7 additions and 3 deletions

View File

@ -10,16 +10,16 @@ final class Argon2i extends Base
public static function subid(string $password): bool
{
return str_starts_with(base64_decode(self::password($password)),self::identifier.'$');
return str_starts_with(self::password($password),self::identifier.'$');
}
public function compare(string $source,string $compare): bool
{
return password_verify($compare,base64_decode($this->password($source)));
return password_verify($compare,$this->password($source));
}
public function encode(string $password): string
{
return sprintf('{%s}%s',self::key,base64_encode(password_hash($password,PASSWORD_ARGON2I)));
return sprintf('{%s}%s',self::key,password_hash($password,PASSWORD_ARGON2I));
}
}

View File

@ -0,0 +1,4 @@
dn: cn=z-module{0},cn=config
changetype: modify
add: olcModuleLoad
olcModuleLoad: argon2