Jump to content

zach.rattner

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by zach.rattner

  1. I did some research on hashing, and it looks like both md5() and sha1() can be reversed, given enough time and processing power. I wrote a function that (I think) would make it considerably more difficult to unhash a value. Do you think this is overkill? Are there any problems that jump out at you? Here is the code:

     

    <?php
    function hyper_hash($value) {
        for ($i = 0; $i < 100; $i++) {
            if ($i %2 == 0) {
                $value = sha1($value);
            }
            else if ($i %3 == 1) {
                $value = base64_encode($value);
            }
            else {
                $value = md5($value);
            }
        }
        return $value;
    }
    
    $initial = microtime(true);
    echo "\"12345\" hashed to: " . hyper_hash("12345"). "<br /><br />";
    $final = microtime(true);
    $delta = $final - $initial;
    echo "Time taken: " . $delta . " s";
    
    ?>
    Here's a page with this code running: [removed]

     

    Thanks for the feedback,

    Zach

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.