Tiny URLs

This is one of those things I probably should have known about a long time ago. I've noticed the tinyurl domain from time to time, but just assumed it was a service provider. But I noticed a link yesterday and observed (finally) that it was self-referential: the url actually was tiny. It became obvious that the url was just a hash that pointed to something more substantial. So I checked out their site to verify. You can even try it out here:

Enter a long URL to make tiny:

I could certainly use this idea in web programs I've developed in the last couple of years. The openIGOR project, in particular, ends up producing long URLs to retrieve files with. But there's no particular reason to actually use the tinyurl.com service--you can easily build one yourself. I guess it's fairly obvious, but I'll spell it out anyway.

In the example I mentioned, a URL is generated that will retrieve a file from an archive. It might be of the form server.domain.edu/cgi-bin/igor/getfile.pl?ID=12355&key=345677. This is the minimal information needed to retrieve the file: the server address, the script to run, the file ID, and a randomly generated key to provide modest security. Suppose you had a server named url on your domain. Instead of using the longish URL shown above, you could have it mapped to url.domain.edu/a452. The sole function of this url server would be to provide pointers that map from short URLs to long ones. Then you'd just need to set up the database scripts to automatically create these (unlike the tinyurl.com ones, which are user-generated using the form above). For security considerations, you'd still have to make the URLs non-sequential, and use about 5-6 characters. With lower and upper-case letters, and numerals, each character has 62 possibilities, so with 5 of these there are over nine hundred million possibilities in total.

Final note: The actual tinyurl.com URLs seem to be sequential. That is, it looks like a database simply increments to the next usable code. The result is that if you randomly fill in the end of the url, you'll get a random page! I tried tinyurl.com/1234 and got a Google paint shop pro forum.


Post a Comment

Links to this post:

Create a Link

<< Home