Google
 
badtech.org badtech.org

Powered By Gentoo Linux
Powered By Apache
Powered By PHP
Powered By PostgreSQL
Powered By MyDNS
Valid CSS
Valid HTML 4.01 Strict



Generate an MD5 hash from a string.


Input:
Output:

This form is AJAX enabled, so using the submit button is not necessary unless you aren't using JavaScript.

I find this useful to generate a starter password for a new web application. I wouldn't type anything important into this form.

Source Code:

md5.php

<script language="javascript"  type="text/javascript">

    function handleHttpResponse() {
        if (http.readyState == 4) {
                document.output.output.value=http.responseText;
            }
        }
    

    function getmd5() {
        var md5input = document.getElementById("input").value;
      http.open("GET", "md5_worker.php?input=" + escape(md5input), true);
        http.onreadystatechange = handleHttpResponse;
        http.send(null);
    }
    
    function getHTTPObject() {
        if (typeof XMLHttpRequest != 'undefined') {
            return new XMLHttpRequest();
        }
        try {
            return new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                return new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
        return false;
    }
    
    var http = getHTTPObject(); // We create the HTTP Object

</script>

<?php
    
if (@$_POST['input']) {
        
$input = $_POST['input'];
        
$input = substr($input,0,255);
        
$output = md5($input);
    }
?>
<h3>Generate an MD5 sum from a string.</h3>
<table>
<form name="md5sum" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
    <tr><td>Input:</td><td><input type="text" name="input" id="input" MAXLENGTH="255" onkeyup="getmd5();" size="50" value="<?php echo @htmlspecialchars($input);?>">
    <input type="submit" name="submit" value="Submit"></td></tr>
</form>
<br>

<form name="output">
    <tr><td>Output:</td><td><input type="text" name="output" size="50" value="<?php echo @$output;?>"><br></td></tr>
</form>
</table>

md5_worker.php

<?php
if ($input = @$_GET['input']) {
    
$input = substr($input,0,255);
    echo
md5($input);
}
?>


Adam Field - adam AT badtech DOT org