Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Here is a related question. Is creating a hash of letters and numbers instead of just using an ID beneficial in anyway?


The only benefit is that by switching from base 10 to base 36 or base 62 (26 lowercase + 26 uppercase + numbers) you are average URL will be shorter. You can usually do this using http://php.net/base_convert


It's about length. If you limit yourself to numbers you only get 10 possible characters instead of 36 if you use letters or 62 if you make them case sensitive.


By an ID I simply mean starting at 1 and moving up from there


It prevents people from iterating over all URLs in your database. Whether or not you consider that a plus or a minus, is mostly up to you.

It also prevents people from easily seeing how many URLs you've shortened.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: