Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do sites like tinyurl generate urls?

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?


2 Answers

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

like image 114
alxkls Avatar answered Sep 22 '25 23:09

alxkls


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.

like image 38
Can Berk Güder Avatar answered Sep 23 '25 00:09

Can Berk Güder