[Release]AllHash script (php)

12/28/2009 12:28 Zombe#1
Hello, guys. Sorry, I'm not really German so I'll be writing in English.

This is a little script I wrote on PHP to hash a string with all hashes that your PHP supports. It automatically finds what hashes it supports and then hashes your string using it. I know it's really short and nothing difficult, you may say that anyone can make it, but I find it really useful, so I am releasing it.

PHP Code:
<?php 

/* ----------{Zombe's All-hash page}---------- */ 

echo('<title>All Hash</title>'); 
$pagename $_SERVER[PHP_SELF]; 
if (
$_GET[step] == ''
{  
    echo(

    <center><pre> 
    <Form Name ='form0' action='
$pagename?step=2' Method ='POST'> 
    Enter the string to hash:<p> 
    <input name='str' type='text' value=''><p> 
    <input name='submit' type='submit' value='Hash!'> 
    </form0> 
    </pre></center> 
    "
); 

elseif (
$_GET['step'] == '2'

    echo(

    <center> 
    <b><u><font size=5>
$_POST[str]</font></u></b><p> 
    <table border='1'> 
    <tr> 
    <td align='center'><b>Hash algorythm</b></td> 
    <td align='center'><b>Hashed string</b></td> 
    </tr> 
    "
); 
    foreach(
hash_algos() as $hash
    { 
        
$hashed hash($hash,$_POST[str]);
        echo(

        <tr> 
        <td align='center'>
$hash</td> 
        <td align='center'>
$hashed</td> 
        </tr> 
        "
); 
    } 
    echo
'</table>'

?>
Screens:

Updated 09/12/29 13:22 : Added title, made the 1st page look a little nicer.

Enjoy. ;)
12/29/2009 00:21 conquer93#2
This better

Code:
   <form method="post">
        <label for="str">Tekst:</label> <input id="str" name="str"><br />
        <input name="submit" type="submit" value="Hash!">
    </form>
<?php
if(isset($_POST['str']) && !empty($_POST['str']))
{
?>
    <h1 style="text-decoration: underline"><?php echo $_POST['str']; ?></h1>
    <table border="1">
        <tr>
            <td align="center"><strong>Hash</strong></td>
            <td align="center"><strong>Hashed string</strong></td>
        </tr>
<?php
    foreach(hash_algos() as $hash)
    {
?>
        <tr>
            <td align="center"><?php echo $hash; ?></td>
            <td align="center"><?php echo hash($hash,$_POST['str']); ?></td>
        </tr>
<?php
    }
?>
    </table>
<?php
}
?>
12/29/2009 01:52 tim66613#3
Quote:
Originally Posted by conquer93 View Post
This better

Code:
   <form method="post">
        <label for="str">Tekst:</label> <input id="str" name="str"><br />
        <input name="submit" type="submit" value="Hash!">
    </form>
<?php
if(isset($_POST['str']) && !empty($_POST['str']))
{
?>
    <h1 style="text-decoration: underline"><?php echo $_POST['str']; ?></h1>
    <table border="1">
        <tr>
            <td align="center"><strong>Hash</strong></td>
            <td align="center"><strong>Hashed string</strong></td>
        </tr>
<?php
    foreach(hash_algos() as $hash)
    {
?>
        <tr>
            <td align="center"><?php echo $hash; ?></td>
            <td align="center"><?php echo hash($hash,$_POST['str']); ?></td>
        </tr>
<?php
    }
?>
    </table>
<?php
}
?>
Besser?, na ja
ist Geschmackssache.
Ich finde es nur noch unübersichtlicher geworden.

MfG tim.
12/29/2009 11:29 conquer93#4
Code:
 echo"
        <center>
        <b><u><font size=5>$_POST[str]</font></u></b><p>
        <table border='1'>
        <tr>
        <td align='center'><b>Hash algorythm</b></td>
        <td align='center'><b>Hashed string</b></td>
        </tr>
    ";
Fail.

use ['str'].
12/29/2009 12:03 Zombe#5
Quote:
Originally Posted by conquer93 View Post
Code:
 echo"
        <center>
        <b><u><font size=5>$_POST[str]</font></u></b><p>
        <table border='1'>
        <tr>
        <td align='center'><b>Hash algorythm</b></td>
        <td align='center'><b>Hashed string</b></td>
        </tr>
    ";
Fail.

use ['str'].
It really doesn't matter. I did use it before, but then I noticed that you don't even need to use it, so I don't use it anymore to make the code shorter.
12/29/2009 12:18 conquer93#6
Quote:
Originally Posted by Zombe View Post
It really doesn't matter. I did use it before, but then I noticed that you don't even need to use it, so I don't use it anymore to make the code shorter.
Lol, i dont use it and it give me errors.

Notice: Use of undefined constant str - assumed 'str' in /media/data/oxan/public_html/test.php on line 20
Notice: Use of undefined constant str - assumed 'str' in /media/data/oxan/public_html/test.php on line 29
Notice: Undefined index: step in /media/data/oxan/public_html/test.php on line 4
12/29/2009 12:24 Zombe#7
Quote:
Originally Posted by conquer93 View Post
Lol, i dont use it and it give me errors.

Notice: Use of undefined constant str - assumed 'str' in /media/data/oxan/public_html/test.php on line 20
Notice: Use of undefined constant str - assumed 'str' in /media/data/oxan/public_html/test.php on line 29
Notice: Undefined index: step in /media/data/oxan/public_html/test.php on line 4
Thant means you should update your php to the latest version (5.2.12 I think).
Anyway, script updated to make it look a tiny bit nicer.
12/29/2009 12:49 Rikkami#8
Danke für die Mühe.
12/29/2009 13:49 conquer93#9
Quote:
Originally Posted by Zombe View Post
Thant means you should update your php to the latest version (5.2.12 I think).
Anyway, script updated to make it look a tiny bit nicer.
Its a string, ['str'] its better coding.