Here's a cool trick you could try. Since your clear in simple ascii
characters, run it through Base64 *decode* first. This will give it a
byte[] that's 25% smaller than the original. (Actually, since it would have
to pad the input string out to a multiple of 4 character before reducing it
to a multiple of 3, you'll end up of 9 bytes).
Play with those 9 bytes as you please (swap some of them, xor them with
some constant, etc). Then Base64 encode them, and you're back up to only 12
characters. Since each byte of the compress array is made up of parts of
two character, it should have the xor/character swap problem you describe.
Actually, with only 10 characters domain in your input string, Jon's
idea of converting it to an integer would probably be best, but this works
for anything whose domain is just upper/lower case letters & digits.
--
Truth,
James Curran
Home:
www.noveltheory.com Work:
www.njtheater.com
Blog:
www.honestillusion.com Day Job:
www.partsearch.com
(note new day job!)
"Drebin" <th*******@hotm ail.com> wrote in message
news:7k******** ***********@new ssvr31.news.pro digy.com...
It's a long story really, but the bottom line is we need to encrypt or
obfuscate a clear-text 9-digit SSN/taxpayer ID into something less than 21
characters. It doesn't need to be super-secure, just something that isn't
plain-text and it HAS to be as unique as the original number. It also does
not need to be a symmetric algorithm - we are using this as a way to
create a unique "userid" on a system to which we single-signon. So it's used
programmaticall y only.
DES/3DES/RC2 are 24 characters, MD5 is 24 (I think?) and SHA1 is 40 - so
those are out
So then, I was just going to do an XOR "encryption " (and I use that word
lightly) - but you'd have to use a second unique value, for each SSN - to
not have this become basically a character swap. In other words, if I use
one "key", then "9" always translates to A - for ALL SSN's.. which is bad,
because it's very easy to pick out the pattern.
SO.. anyone have any ideas of how to mangle up a 9-digit SSN in 20 chars
or less?? Maybe I'm overthinking the problem somehow?