DISCLAIMER: I do not ask how to make the URL abbreviation (I already carried out the answer "bijective function" found HERE , which uses a base-62 encoded string). Instead, I want to extend this implementation to obfuscate the generated string so that it is:
A) not an easily guessed sequence , but
B) still bijective.
You can easily randomize the base-62 character set, but the problem is that it is still increasing, like any other number in any other database. For example, one possible incremental progression may be{aX9fgE, aX9fg3, aX9fgf, aX9fgR, … ,}
I came up with an obfuscation method that I am satisfied with in terms of requirement A) , but I'm only partially sure that it satisfies B) . The idea is this:
The only thing that can guarantee a change in the incremental approach is "1st place" (I will use decimal terminology for practical reasons). In the example I gave earlier, it will be {E, 3, f, R, …}. Therefore, if each character in the base-62 set has its own unique number of offsets (say, its distance from the “zero character”), then you can apply the “1 place” character offset to the rest of the string.
For example, let's say a base-5 set with characters {A, f, 9, p, Z, 3}(in ascending order from 0 to 5). Each of them will have a unique offset from 0 to 5, respectively. The count will look like {A, f, 9, p, Z, 3, fA, ff, f9, fp, …}and so on. Thus, when setting the value, the algorithm fZ3pwill look at pand, having an offset of +3, rearrange the string in Zf9p(provided that the base-5 set is a circular array). The next incremental number will be fZ3Z, and with an Zoffset of +4, the algorithm returns 39pZ. These permutation results will be passed to the user as his "unique URL", which will never see the actual base-62 encoded string.
, , ; . , . , ? - , ?
.. URL-, . , , , .. , A), , , , B) ".
, , .