简短的,不区分大小写的字符串混淆策略 [英] Short, case-insensitive string obfuscation strategy

查看:55
本文介绍了简短的,不区分大小写的字符串混淆策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来识别(即,对进行编码)带有一个令牌的一组Java字符串.标识不应涉及数据库持久性.到目前为止,我已经研究了Base64编码和DES加密,但是就以下要求而言,两者都不是最佳选择:

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:

  • 令牌应尽可能短
  • 令牌应对大小写不敏感
  • 令牌应在URLEncoder/Decoder往返过程中生存(即将在URL中使用)

Base32是我最好的选择吗?还是有更好的选择?请注意,我主要对缩短&混淆集合,加密/安全性并不重要.

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.

推荐答案

文本(即一组字符串)的结构是什么?您可以利用对它的了解,以一种简短的形式对其进行编码.例如.如果您有一个大的十进制基数"1234567890",则可以将其转换为36个基数,该基数将更短.

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.

如果您不关心长度,那么可以,唯一的选择是使用基于字母的编码器(例如Base32)进行处理.

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

另外,如果文本足够大,也许可以通过gzip压缩节省一些空间.

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

这篇关于简短的,不区分大小写的字符串混淆策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆