note 94990 modified in ref.hash by danbrown
| From: | danbrown@php.net | Date: | Mon, 07 Dec 2009 16:12:22 +0000 |
| Subject: | note 94990 modified in ref.hash by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163667@lists.php.net to get a copy of this message | ||
For Samba ueserPassword you can use:
(I am not very sure aboute the salt part, but it works for me like that)
<?php
function CRYPThash($string, $salt = null)
{
if (!$salt)
$salt = rand(10,99);
return "{CRYPT}".crypt($string, $salt);
}
?>
In posted NTLMHash function you can also use:
<?php
// Encrypt it with the MD4 hash
$MD4Hash=hash('md4',$Input);
?>
So you don't need to install mhash libraries
--was--
For Samba ueserPassword you can use:
(I am not very sure aboute the salt part, but it works for me like that)
function CRYPThash($string, $salt = null)
{
if (!$salt)
$salt = rand(10,99);
return "{CRYPT}".crypt($string, $salt);
}
In posted NTLMHash function you can also use:
// Encrypt it with the MD4 hash
$MD4Hash=hash('md4',$Input);
So you don't need to install mhash libraries
http://php.net/manual/en/ref.hash.php