Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Short, case-insensitive string obfuscation strategy

I am looking for a way to identify (i.e. encode and decode) a set of Java strings with one token. The identification should not involve DB persistence. So far I have looked into Base64 encoding and DES encryption, but both are not optimal with respect to the following requirements:

  • Token should be as short as possible
  • Token should be insensitive to casing
  • Token should survive a URLEncoder/Decoder round-trip (i.e. will be used in URLs)

Is Base32 my best shot or are there better options? Note that I'm primarily interested in shortening & obfuscating the set, encryption/security is not important.

like image 563
Rahel Lüthy Avatar asked Oct 24 '25 03:10

Rahel Lüthy


1 Answers

What's a structure of the text (i.e. set of strings)? You could use your knowledge of it to encode it in a shorten form. E.g. if you have large base-decimal number "1234567890" you could translate it into 36-base number, which will be shorter.

Otherwise it looks like you are trying invent an universal archiver.

If you don't care about length, then yes, processing by alphabet based encoder (such as Base32) is the only choice.

Also, if text is large enough, maybe you could save some space by gzipping it.

like image 196
kan Avatar answered Oct 26 '25 17:10

kan