Fengshui said:
domain rule is as: caseless letters, numbers and -
username rule is letters. numbers, -, _ and .
so if I want to covert/encript an email into a letter/number only string,
how do i do this without adding length to the string? i don't want to just
exchange ascii code for each one.
If you just want to keep spiders from picking up email addresses I
would simply reverse the string, like Abigail said or remove the
punctuation and replace with something else. Perl's tr or s should
work fine here.
If you want to keep it from prying human eyes, as long as they are
lazy something simple should work.
You don't want to do an even ASCII exchange mapping because you don't
want to access a table like you say in one of your follow ups? You
wouldn't need to even use a table. You could just use a simple
algorithm. Add or subtract some number from your ascii code(make sure
you stay within the bounds of what can be transferred by your medium,
and make a simple escape sequence for illegal characters), then do the
reverse on the flip side.
On the other hand if your issue is that a simple mapping is too easy
and someone could figure it out then I would say you are probably
stuck with increasing the length. I don't see how you could add
complexity using the same number or less of characters and the same
character set, unless the data set had large quantities of repetitive
data which would lend itself to compression. Any mathmaticians want to
advise on this one?
Lastly, I think you are going the wrong direction talking about
converting to a different character set, or encoding using hex. If you
want to represent all usable ASCII characters you are talking a
minimum of 128 characters, and extended ASCII is 256. That means 2
places in hex and 3 in decimal. Then you need to represent that in
"characters" to transfer it, so you are doubling or tripling the size
of the string. In other words, using base-10 or base-16 to represent
base-128 is definately going to make your string longer, since you
will no be transferring integers, you will be transferring characters
which will get implicitly converted back to integers when you use
them.
Let me know if this makes any sense. I am tired and rambling a little.
-GPK