Search code examples
phphashuniqueurlencode

PHP: reverse able unique hash


I'm building a browser in PHP (browser in browser (: just for fun ) , and i have come across a major problem. I need to short a URL into something shorter (encoded) which can be reverse able.

for example now i process the page like that :

site.com/stackoverflow.com/questions/9217271/php-reverse-able-unique-hash

and that's too long , i was looking for something that will be like that :

site.com/sftDblt

which the "sftDblt" can be reverse able to "stackoverflow.com/questions/9217271/php-reverse-able-unique-hash"

is there anything you know about that can help?


Solution

  • A hash can't be reversed. You should go with http://php.net/manual/en/book.mcrypt.php