note 82018 added to ref.hash
| From: | CraquePipe at osu1 dot php dot net | Date: | Tue, 25 Mar 2008 00:42:41 +0000 |
| Subject: | note 82018 added to ref.hash | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137536@lists.php.net to get a copy of this message | ||
For thoes of you who're looking to generate an NTLM hash (not an LM hash), I found out
it's quite simple..
It uses the basic MD4 function, but the password needs to be in Unicode Little Endian encode first
(this canbe achieved by the iconv function).
This can be done easily by using the following code:
<?php
function NTLMHash($Input) {
// Convert the password from UTF8 to UTF16 (little endian)
$Input=iconv('UTF-8','UTF-16LE',$Input);
// Encrypt it with the MD4 hash
$MD4Hash=bin2hex(mhash(MHASH_MD4,$Input));
// You could use this instead, but mhash works on PHP 4 and 5 or above
// The hash function only works on 5 or above
//$MD4Hash=hash('md4',$Input);
// Make it uppercase, not necessary, but it's common to do so with NTLM hashes
$NTLMHash=strtoupper($MD4Hash);
// Return the result
return($NTLMHash);
}
?>
To produce an LM hash requires a fully-written script containing the algorithm used to make it.
Enjoy,
CraquePipe.
----
Server IP: 83.170.119.58
Probable Submitter: 85.210.71.58
----
Manual Page -- http://www.php.net/manual/en/ref.hash.php
Edit -- https://master.php.net/note/edit/82018
Del: integrated -- https://master.php.net/note/delete/82018/integrated
Del: useless -- https://master.php.net/note/delete/82018/useless
Del: bad code -- https://master.php.net/note/delete/82018/bad+code
Del: spam -- https://master.php.net/note/delete/82018/spam
Del: non-english -- https://master.php.net/note/delete/82018/non-english
Del: in docs -- https://master.php.net/note/delete/82018/in+docs
Del: other reasons-- https://master.php.net/note/delete/82018
Reject -- https://master.php.net/note/reject/82018
Search -- https://master.php.net/manage/user-notes.php