I looked at tinyurl, tinypic, imgur and youtube! I thought they would use a text safe representation of a index and use it as a primary ID in their DB. However trying to put the keys into Convert.FromBase64String("key") yields no results and throw an exception. So these sites dont use a base64 array. What are they using? What might i want to use if i were to do a youtube like site or tinyurl?
Asked
Active
Viewed 2,410 times
3 Answers
3
im guessing they have developed their own encoding which is simply an alphanumeric equivalent of the ids in their database. im sure they dont generate random strings simply because this will cause catastrophic overflows at a certain point

alxkls
- 31
- 1
2
I don't know about TinyURL, Tinypic, etc. but shorl.com uses something called koremutake.
If I were to develop such a system, I guess some sort of short hash or plain random strings could be possible choices.

Can Berk Güder
- 109,922
- 25
- 130
- 137
1
My guess is that they simply generate a random string and use that as the primary key. I don't really see a reason to do anything else.

ryeguy
- 65,519
- 58
- 198
- 260
-
using a hash algorithm could also be a viable alternative, as it prevents storing the same thing twice. on the other hand, storage is dirt cheap these days, so I don't really know if that's necessary. – Can Berk Güder Aug 26 '09 at 14:00
-
I tried entering the same url into the tinyurl generator multiple times and it outputs the same shortened url. – dardub Oct 17 '12 at 06:20