Skip to content

Commit 3c1f016

Browse files
authored
Create NT password fix (#282)
1 parent 04868c5 commit 3c1f016

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/createlm.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,12 @@ public function lmhash($password = "") {
348348
* @return string hash value
349349
*/
350350
public function nthash($password = "") {
351-
if (function_exists('mhash'))
352-
if (defined('MHASH_MD4'))
353-
return strtoupper(bin2hex(mhash(MHASH_MD4,iconv('UTF-8','UTF-16LE',$password))));
354-
else
355-
return strtoupper(hash('md4', iconv("UTF-8","UTF-16LE",$password)));
351+
if (function_exists('hash'))
352+
return strtoupper(hash('md4', iconv("UTF-8","UTF-16LE",$password)));
353+
elseif (function_exists('mhash') && phpversion() < '8.1' && defined('MHASH_MD4'))
354+
return strtoupper(bin2hex(mhash(MHASH_MD4,iconv('UTF-8','UTF-16LE',$password))));
356355
else
357-
error(_('Your PHP install does not have the mhash() function. Cannot do hashes.'),'error','index.php');
356+
error(_('Your PHP install does not have hash() nor mhash() function. Cannot do hashes.'),'error','index.php');
358357
}
359358

360359
/**

0 commit comments

Comments
 (0)