Poor man's view of the world

Hash calculator (php)

This is a very simple php code for a hash calculator.

To see a working demo of this code, visit: http://www.rohasnagpal.com/projects/hash

There are two pages, index.htm and hash.php The index.htm page contains a simple form to submit the text to be hashed. The hash.php page displays the md5 hash result.

code for index.htm

<form action=hash.php method=get>
<input type="text" name="word">
<input type=submit value="Hash this text">
</form>

 

code for md5.php

<?php
$str = $_REQUEST["word"];
?>
<p>
Original text entered by you:<br><b>
<?php echo $_REQUEST["word"]; ?>

<p></b>The hashes for this text are:<br><br><b>

<p><p>

<?php
$data = $str;

foreach (hash_algos() as $v) {
        $r = hash($v, $data, false);
        printf("%-12s %3d %s<br /><br />", $v, strlen($r), $r);
    //echo $v.$r."<p>";
}
?>

To see a working demo of this code, visit: http://www.rohasnagpal.com/projects/hash

Tags: