How to convert long urls to short urls??

I have an application to bang my head for couple of days. It has to
convert the long urls to be converted to short urls like the ones in .

tip: Google custom search engines

google hurl. It's an open source tinyurl implementation in ruby (using
camping framework) i think...