Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/password/config.inc.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ $config['password_force_new_user'] = false;

// Password hashing/crypting algorithm.
// Possible options: des-crypt, ext-des-crypt, md5-crypt, blowfish-crypt,
// sha256-crypt, sha512-crypt, md5, sha, smd5, ssha, ssha256, ssha512, samba, ad, dovecot, clear.
// sha256-crypt, sha512-crypt, md5, sha, smd5, ssha, ssha256, ssha512, samba|nt-hex, nt-binary, ad, dovecot, clear.
// Also supported are password_hash() algoriths: hash-bcrypt, hash-argon2i, hash-argon2id.
// Default: 'clear' (no hashing)
// Hash type nt-binary is NOT human-readable and its corresponding DB column must be of type 'BYTEA' for PostgreSQL or BINARY(16) for MySQL.
// For details see password::hash_password() method.
$config['password_algorithm'] = 'clear';

Expand Down
13 changes: 13 additions & 0 deletions plugins/password/password.php
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ public static function hash_password($password, $method = '', $prefixed = true)
$prefix = '{SMD5}';
break;
case 'samba':
case 'nt-hex':
if (function_exists('hash')) {
$crypted = hash('md4', rcube_charset::convert($password, RCUBE_CHARSET, 'UTF-16LE'));
$crypted = strtoupper($crypted);
Expand All @@ -668,6 +669,18 @@ public static function hash_password($password, $method = '', $prefixed = true)
], true, true);
}

break;
case 'nt-binary':
if (function_exists('hash')) {
$crypted = hash('md4', rcube_charset::convert($password, RCUBE_CHARSET, 'UTF-16LE'), true);
$crypted = strtoupper($crypted);
} else {
rcube::raise_error([
'code' => 600,
'message' => 'Password plugin: Your PHP installation does not have hash() function',
], true, true);
}

break;
case 'ad':
$crypted = rcube_charset::convert('"' . $password . '"', RCUBE_CHARSET, 'UTF-16LE');
Expand Down