Mission: Difficult [encrypt/obfuscate 9-digit SSN into 20 chars or less]

J

James Curran

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!)
 

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

Top