maybe rot-13 can help you. it is sometimes used to "crypt" emails. every char will be shifted 13 places up. 13 because the "normal" alphabet has 26 chars. so when you shift twice, you are at the start again.
see the following functions for some examples:
rot_13() will do the "normal" shift with strings.
rot_13x() integrates numbers (which will be shifted by 5)
rot_18() will put the numbers "into" the alphabet
function rot_13($string)
{
$from = "abcdefghijklmnopqrstuvwxyz";
$to = "nopqrstuvwxyzabcdefghijklm";
return strtr($string, $from, $to);
}
function rot_13x($string)
{
$from = "abcdefghijklmnopqrstuvwxyz0123456789";
$to = "nopqrstuvwxyzabcdefghijklm5678901234";
return strtr($string, $from, $to);
}
function rot_18($string)
{
$from = "abcdefghijklmnopqrstuvwxyz0123456789";
$to = "stuvwxyz0123456789abcdefghijklmnopqr";
return strtr($string, $from, $to);
}
$s = "cryptme12345";
echo "original:$s<br>";
echo "rot-13:".rot_13($s)."<br>";
echo "rot-13x:".rot_13x($s)."<br>";
echo "rot-18:".rot_18($s)."<br>";
$s = rot_13(rot_13x(rot_18($s)));
echo "all-together:$s<br>";
$s = rot_18(rot_13x(rot_13($s)));
echo "original:$s<br>";
will output:
original:cryptme12345
rot-13:pelcgzr12345
rot-13x:pelcgzr67890
rot-18:u9g7b4wjklmn
all-together:u4g2b9wjklmn
original:cryptme12345
hope that helps. may write your own shift-funcs. strtr() is very handy for that.
these are no crypt funcs, of course.
things like:
echo rot_13("hellohello") -> uryyburyyb are quite obvious.
you can work with strrev(), or, if you'll always have a fixed-size string,
split him up in smaller parts and change their order.
many things you can do.
have fun
joe