note 103447 deleted from ref.hash by danbrown
| From: | danbrown@php.net | Date: | Thu, 14 Apr 2011 15:02:24 +0000 |
| Subject: | note 103447 deleted from ref.hash by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-178846@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
***Just edited below to add string length!***
<body>
<h1>String hashing</h1>
<form method="post" action="<?php echo basename(__FILE__) ?>">
<p><label for="p">Enter a string to hash:</label><br
/><input id="p" type="text" name="p" value="<?php echo
$p ?>" /></p>
<p><input type="submit" name="submit" value="Hash It"
/></p>
</form>
<?php /* If there is a posted value use it */ ?>
<?php if ($p): ?>
<hr />
<h2>Table of hash values for <em><?php echo $p ?></em> based on
algorithm</h2>
<table>
<tr>
<th>Algorithm</th>
<th>Hashed value of <em><?php echo $p ?></em></th>
<th>Length</th>
</tr>
<?php /* Loop through each hash algorithm, colorizing every other row */ ?>
<?php $on = false; foreach (hash_algos() as $algo): ?>
<tr<?php if ($on): ?> class="on"<?php endif; ?>>
<td class="algo"><?php echo $algo ?></td>
<td class="hash"><?php $b = hash($algo, $p); echo $b;
?></td>
<td class="algo"><?php echo strlen($b) ?></td>
</tr>
<?php $on = !$on; endforeach; ?>
</table>
<?php endif; ?>
</body>