Will this obfuscation algorithm work for a short url?

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) ".

, , .

+3
4

, , , , .

, . URL-, , , , , (, 64), URL- , URL- .

- . , , . , , URL-, , .

, , - 40- RC4. , , .

, DES. , .

, AES.

, URL- . RC4-40 5 , DES 7 AES 32 . , , .

+2

-Rackoff ( ), .

" " F. F K , . F , , .

Luby-Rackoff (. " " ) , K.

, , , F .

+1

( php) :

, A): ( ), , algo

B): 100% .

@Nemo feistel, , .

+1

URL-, , , , URL .

Here is a simple idea: take your URL and add some random characters to it. Then run it using the compression algorithm - I would try range coding (you can probably specify the base if you find a good library). This should be decompressible to its original form and should affect locality and make the encoded space more sparse.

However, I think that almost all shortened URLs contain a hash table with server-side status. How else are you going to losslessly compress a 100-character URL to 5 or 6 characters?

0
source

All Articles