I need to encrypt three strings, each stored as MySql varchar's, email_address, first_name, last_name.
So I need to convert "larry@perl.com" , "Larry" and "Monk" into encrypted strings.
I thought I'd use crypt::cbc to encrypt "larry@perl.com" but that gives me a string with some characters that I figure could cause me problems, so I then converted the result into a hex string with the following: (my $str = shift) =~ s/(.|\n)/sprintf("%02lx", ord $1)/eg;
Problem is that's not very efficient, my output is twice as long as my input.
What's a good way to convert "larry@perl.com" into "aBcDeFgH123456" for example, so both strings are the same or similar length, if indeed that's possible.