Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL shortener with no database

I'd like to write a URL shortener that doesn't have to use a database. Instead, to have as few moving parts as possible, the script would just create a unique hash for my URL based on an algorithm (like md5, except an md5 would be too long). I'm not really sure how I'd go about doing this. Any advice?

If it matters, I'd prefer to write this in Ruby.

like image 215
Jason Swett Avatar asked Jan 27 '11 15:01

Jason Swett


1 Answers

You could do this with several of the string manipulation tools available to transform a URL into something obscured however as you noted in your question the url's you get from doing this would be longer than is typical for a url shortener.

url's don't compress very well.

like image 107
ramnet Avatar answered Oct 15 '22 16:10

ramnet