Added password change support for argon2i/argon2id, added matching config options and hash_X functions
This commit is contained in:
parent
1f993c336b
commit
38a4a86e24
|
@ -596,6 +596,45 @@ class PassHash {
|
|||
return ':B:'.$salt.':'.md5($salt.'-'.md5($clear));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Password hashing method 'argon2i'
|
||||
*
|
||||
* Uses php's own password_hash function to create argon2i password hash
|
||||
* Default Cost and thread options are used for now.
|
||||
*
|
||||
* @link https://www.php.net/manual/de/function.password-hash.php
|
||||
*
|
||||
* @param string $clear The clear text to hash
|
||||
* @param string $salt not used, defaults to null
|
||||
* @return string Hashed password
|
||||
*/
|
||||
public function hash_argon2i($clear,$salt = null) {
|
||||
if(!defined('PASSWORD_ARGON2I')) {
|
||||
throw new \Exception('This PHP installation has no ARGON2I support');
|
||||
}
|
||||
return password_hash($clear,PASSWORD_ARGON2I);
|
||||
}
|
||||
|
||||
/**
|
||||
* Password hashing method 'argon2id'
|
||||
*
|
||||
* Uses php's own password_hash function to create argon2id password hash
|
||||
* Default Cost and thread options are used for now.
|
||||
*
|
||||
* @link https://www.php.net/manual/de/function.password-hash.php
|
||||
*
|
||||
* @param string $clear The clear text to hash
|
||||
* @param string $salt not used, defaults to null
|
||||
* @return string Hashed password
|
||||
*/
|
||||
public function hash_argon2id($clear,$salt = null) {
|
||||
if(!defined('PASSWORD_ARGON2ID')) {
|
||||
throw new \Exception('This PHP installation has no ARGON2ID support');
|
||||
}
|
||||
return password_hash($clear,PASSWORD_ARGON2ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps around native hash_hmac() or reimplents it
|
||||
*
|
||||
|
|
|
@ -125,7 +125,7 @@ $meta['autopasswd'] = array('onoff');
|
|||
$meta['authtype'] = array('authtype','_caution' => 'danger');
|
||||
$meta['passcrypt'] = array('multichoice','_choices' => array(
|
||||
'smd5','md5','apr1','sha1','ssha','lsmd5','crypt','mysql','my411','kmd5','pmd5','hmd5',
|
||||
'mediawiki','bcrypt','djangomd5','djangosha1','djangopbkdf2_sha1','djangopbkdf2_sha256','sha512'
|
||||
'mediawiki','bcrypt','djangomd5','djangosha1','djangopbkdf2_sha1','djangopbkdf2_sha256','sha512','argon2i','argon2id'
|
||||
));
|
||||
$meta['defaultgroup']= array('string');
|
||||
$meta['superuser'] = array('string','_caution' => 'danger');
|
||||
|
|
Loading…
Reference in New Issue