note 84587 added to ref.hash

From: Date: Sun, 20 Jul 2008 19:35:55 +0000
Subject: note 84587 added to ref.hash
Groups: php.notes 
Request: Send a blank email to php-notes+get-142301@lists.php.net to get a copy of this message
And some code for LM hash: <?php function LMhash($string) { $string = strtoupper(substr($string,0,14)); $p1 = LMhash_DESencrypt(substr($string, 0, 7)); $p2 = LMhash_DESencrypt(substr($string, 7, 7)); return strtoupper($p1.$p2); } function LMhash_DESencrypt($string) { $key = array(); $tmp = array(); $len = strlen($string); for ($i=0; $i<7; ++$i) $tmp[] = $i < $len ? ord($string[$i]) : 0; $key[] = $tmp[0] & 254; $key[] = ($tmp[0] << 7) | ($tmp[1] >> 1); $key[] = ($tmp[1] << 6) | ($tmp[2] >> 2); $key[] = ($tmp[2] << 5) | ($tmp[3] >> 3); $key[] = ($tmp[3] << 4) | ($tmp[4] >> 4); $key[] = ($tmp[4] << 3) | ($tmp[5] >> 5); $key[] = ($tmp[5] << 2) | ($tmp[6] >> 6); $key[] = $tmp[6] << 1; $is = mcrypt_get_iv_size(MCRYPT_DES, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($is, MCRYPT_RAND); $key0 = ""; foreach ($key as $k) $key0 .= chr($k); $crypt = mcrypt_encrypt(MCRYPT_DES, $key0, "KGS!@#$%", MCRYPT_MODE_ECB, $iv); return bin2hex($crypt); } ?> Some optimization? ---- Server IP: 195.54.192.44 Probable Submitter: 127.0.0.1 ---- Manual Page -- http://www.php.net/manual/en/ref.hash.php Edit -- https://master.php.net/note/edit/84587 Del: integrated -- https://master.php.net/note/delete/84587/integrated Del: useless -- https://master.php.net/note/delete/84587/useless Del: bad code -- https://master.php.net/note/delete/84587/bad+code Del: spam -- https://master.php.net/note/delete/84587/spam Del: non-english -- https://master.php.net/note/delete/84587/non-english Del: in docs -- https://master.php.net/note/delete/84587/in+docs Del: other reasons-- https://master.php.net/note/delete/84587 Reject -- https://master.php.net/note/reject/84587 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#142301) next »