Here's a problem I'm trying to create the best solution for. I have a finite set of non-negative integers in the range of [0...N]. I need to be able to represent each number in this set as a string and be able to convert such string backwards to original number. So this should be a bijective function.
Additional requirements are:
- String representation of a number should obfuscate original number at least to some degree. So primitive solution like f(x) = x.toString() will not work.
- String length is important: the less the better.
- If one knows the string representation of K, I would like it to be non-trivial (to some degree) to guess the string representation of K+1.
For p.1 & p.2 the obvious solution is to use something like Base64 (or whatever BaseXXX to fit all the values) notation. But can we fit into p.3 with minimal additional effort? Common sense tells me that I additionally need a bijective "String <-> String" function for BaseXXX values. Any suggestions? Or maybe there's something better than BaseXXX to use to fit all 3 requirements?
enc(k+1)fromenc(k)is pretty much required for a good cipher, since if you could then a known plaintext/cipher pair would give you as many ciphertexts of nearby plaintexts as you had time to compute. I think the question then, is how "bad" (or expensive-to-compute) a cipher are you willing to accept in order to get short cipher texts, whether you're going to use salt or not, and whether you need a streaming mode.