And some code for LM hash:<?phpfunction 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?