encrypt email address to a string

F

Fengshui

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.
 
E

Eric J. Roode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.

How strong do you want the encryption to be? Unless you have an
extreeeemely simple scheme, you're going to add length. Plus, you're
going to have to do annoying things like Huffman-encode bit
sequences. Ick.

What's this for, anyhow?

- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13

iD8DBQE/3LdGY96i4h5M0egRAl/WAJ4lsRfjIm1ju7ETClf+RRDvgHmRjQCgu6XQ
STR6NZgj7WAaDFU2GPAWtD8=
=+Afu
-----END PGP SIGNATURE-----
 
J

James Willmore

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.

I have no idea what you're trying to accomplish other than you want to
encrypt something.

Try one of the many Crypt modules available.
Recently, someone released a module to obfuscate email addresses -
maybe that's really what you want to do?

http://search.cpan.org

HTH
--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
The Kennedy Constant: Don't get mad -- get even.
 
F

Fengshui

How strong do you want the encryption to be? Unless you have an
extreeeemely simple scheme, you're going to add length. Plus, you're
going to have to do annoying things like Huffman-encode bit
sequences. Ick.

What's this for, anyhow?

What I need to do is pretty simple. I need to add email address as a
Referal, but I want it to look something different, so that spammers will
not know that is an email. I don't want to keep a database to make member1 =
(e-mail address removed), member2 = (e-mail address removed)
Example:
(e-mail address removed) can be changed to abcAabcB
A=@
B=.com
but I also want to make the string shorter, because an email can have pretty
long string etc.. My idea is that domain is made of 26+10+1=37 items, and if
I add capital letters than I will have 37+26=63 items, then I do a match to
change a 37 based number to a 63 based number. such as
1234567890abcedfeghi...
then
11 will be 1+37=38 which is A
aa will be 11+37*11=308, which is 4S
111 will be 1+37+37*37=1407...

so in long run, I will make a string much shorter by maping a 38 item to a
63 item. if I add the DOT ., then i will map 39 to 64.

it is a two way string, so that if I look at abcAabcB, I will know what that
is..

I have the idea this, but I don't know what is the largest integer Perl can
handle, and I want to have an algorithm to convert 39 to 64 easiliy, How do
you covert 10 based to 16 based without all those calculatons? I remember
there is something I learned in school, but it is 20 years ago, could not
remember.. My English is poor and I don't know how to search it on google.
How do you call 10based, and 16based? Hex??? Dex???
 
B

Bart Lateur

Fengshui said:
I need to add email address as a
Referal, but I want it to look something different, so that spammers will
not know that is an email. I don't want to keep a database to make member1 =
(e-mail address removed), member2 = (e-mail address removed)

Replace the "@" character with something else. A lot of \W characters
would make a good choice.
 
F

Fengshui

Fengshui> username rule is letters. numbers, -, _ and .

You realize this is not the general case? Email "usernames"
(called "local-part" in RFC terminology) can include every possible
character.

For example, the address <fred&[email protected]> is a perfectly
legal address. (Go ahead and email it! It's an autoresponder.)

As is <*@qz.to>, my acquaintence "Eli the bearded". (And he is
definitely bearded.)

Please don't be so narrowminded about email addresses.

Then, please tell me how the hack I can encode an all charactor thing to a
letter and digital only thing, except assigning 1 value to every email,
which takes file writing, space etc. If will be nice if I can use a key to
encript then use the same key to decode. Do you think something like a XOR
will work?
 
T

Tony Curtis

What I need to do is pretty simple. I need to add email
address as a Referal, but I want it to look something
different, so that spammers will not know that is an
email. I don't want to keep a database to make member1 =
(e-mail address removed), member2 = (e-mail address removed)

Why not?

Maintaining a map of opaque tokens to email addresses sounds
like a really good solution. You could simply create a
configuration file to store this map, or even put it in the
source code.
 
R

Reportor

Why not?

Maintaining a map of opaque tokens to email addresses sounds
like a really good solution. You could simply create a
configuration file to store this map, or even put it in the
source code.

I hate to use flock(). I am trying my best to avoid any WRITE to disk.
 
T

Tony Curtis

I hate to use flock(). I am trying my best to avoid any
WRITE to disk.

Why would you need to write? You'd just be reading a file to
look up a token's corresponding email address.

This also places a buffer between input data and the program's
actions; there's no way anyone can work out what the target
email address is from looking at publicly available
information and you can protect yourself from accepting email
addresses you don't want.
 
G

G Klinedinst

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,143
Messages
2,570,822
Members
47,368
Latest member
michaelsmithh

Latest Threads

Top