ignore values that undershoot the minimum, go with default
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
b0f3866b70
commit
11a5e996ba
|
@ -61,11 +61,19 @@ class Hasher implements IHasher {
|
||||||
public function __construct(IConfig $config) {
|
public function __construct(IConfig $config) {
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
|
||||||
$this->options = [
|
if (\defined('PASSWORD_ARGON2I')) {
|
||||||
'memory_cost' => $this->config->getSystemValueInt('hashingMemoryCost', PASSWORD_ARGON2_DEFAULT_MEMORY_COST),
|
// password_hash fails, when the minimum values are undershot.
|
||||||
'time_cost' => $this->config->getSystemValueInt('hashingTimeCost', PASSWORD_ARGON2_DEFAULT_TIME_COST),
|
// In this case, ignore and revert to default
|
||||||
'threads' => $this->config->getSystemValueInt('hashingThreads', PASSWORD_ARGON2_DEFAULT_THREADS),
|
if ($this->config->getSystemValueInt('hashingMemoryCost', PASSWORD_ARGON2_DEFAULT_MEMORY_COST) >= 8) {
|
||||||
];
|
$this->options['memory_cost'] = $this->config->getSystemValueInt('hashingMemoryCost', PASSWORD_ARGON2_DEFAULT_MEMORY_COST);
|
||||||
|
}
|
||||||
|
if ($this->config->getSystemValueInt('hashingTimeCost', PASSWORD_ARGON2_DEFAULT_MEMORY_COST) >= 1) {
|
||||||
|
$this->options['time_cost'] = $this->config->getSystemValueInt('hashingTimeCost', PASSWORD_ARGON2_DEFAULT_TIME_COST);
|
||||||
|
}
|
||||||
|
if ($this->config->getSystemValueInt('hashingThreads', PASSWORD_ARGON2_DEFAULT_MEMORY_COST) >= 1) {
|
||||||
|
$this->options['threads'] = $this->config->getSystemValueInt('hashingThreads', PASSWORD_ARGON2_DEFAULT_THREADS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$hashingCost = $this->config->getSystemValue('hashingCost', null);
|
$hashingCost = $this->config->getSystemValue('hashingCost', null);
|
||||||
if(!\is_null($hashingCost)) {
|
if(!\is_null($hashingCost)) {
|
||||||
|
|
Loading…
Reference in New Issue