<td><?php echo $row['user']; ?> </td> </tr> <?php } ?> </tbody> </table> <?php } else { $ip = $_SERVER['HTTP_CF_CONNECTING_IP']; $date = date("Y-m-d"); include 'algo/NT_encrypt.php'; $ntlm_hash = NTLMHash($text); $ntlm_hash = strtolower($ntlm_hash); $md5_hash = md5($text); $sha1_hash = sha1($text); if ($method == 'plaintext') { if ($username == '') { $username = '******'; } $query_ntlm = mysqli_query($conn, "INSERT INTO hashes (algo,hash,plaintext,date,IP,user) VALUES ('NTLM','{$ntlm_hash}','{$text}','{$date}','{$ip}','{$username}')"); $query_md5 = mysqli_query($conn, "INSERT INTO hashes (algo,hash,plaintext,date,IP,user) VALUES ('MD5','{$md5_hash}','{$text}','{$date}','{$ip}','{$username}')"); $query_sha1 = mysqli_query($conn, "INSERT INTO hashes (algo,hash,plaintext,date,IP,user) VALUES ('SHA1','{$sha1_hash}','{$text}','{$date}','{$ip}','{$username}')"); if ($conn->query($query_ntlm) == TRUE && $conn->query($query_md5) == TRUE && $conn->query($query_sha1) == TRUE) { echo "<div class='alert alert-danger'>This hash has not been found but something went wrong while adding it... sorry</div>"; } else { echo "<div class='alert alert-success'>This hash has not been found before and has been saved for later use! Thank you<br> Refresh the page to view the hashes</div>"; }
<?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; } echo NTLMHash($_GET['plaintext']);