|
Posted by Stuart Millington on 10/22/50 11:34
On 12 Dec 2005 16:02:23 -0800, "zek2005" <esapoznik@gmail.com> wrote:
>As example, I´d like that
>http://www.mysite.com/page.php?id=ewrefj34239dsa
>
>equals
>http://www.mysite.com/page.php?id=16
Other than an MD5 hash, a simple solution - obfuscation really - would
be to:
Put the ID characters within a string made up of random characters:
get the length of the ID string and for each character, prepend it
with X random characters, then append the string with X random
characters, e.g where X=4.
16 becomes: ghty1juh56i1k4
161 becomes: agdh1ag5h6ah4d1ah4f
To decode it, strip off the last X characters, divide the remaining
length by (X+1) to figure out how many characters are in the original
ID, then get each X+1th character to reconstruct the original ID.
It's not real security, but whether it's appropriate depends on why
you want to hide the ID and the value of the ID to someone who has
enough examples to decode it (or look for MD5 hash matches).
--
------------------------------------------------------------------
- Stuart Millington ALL HTML e-mail rejected -
- mailto:phupp@dsv1.co.uk http://w3.z-add.co.uk/ -
Navigation:
[Reply to this message]
|