From: Peter Skovgaard Date: 2007-08-17T04:21:18+09:00 Subject: shorten SHA1-hash In one of my railsapplications I have system for up/downloading files. Since I don't want people to browse all the files, but anyone should be able to link to his/her files each file has it's own unique URL - all pretty standard. Right now the URL just is /download/sha-sum-of-the-file (since I have the SHA anyway), but the length of the url is bugging me. Now - the problem: The SHA1-sum is, as usually, just represented in base16 which makes it 40 chars long. However, in an url we have at least a-zA-Z0-9 (and also some special characters) which gives us the opportunity to represent the SHA-sum in at least base62 which should make it about half the size. I know that I in this case just could store an extra little random string in my database and link to /download/little-string, but that's not the point here :) I would just like to hear you: How few (printable) characters can you shorten a SHA-sum down to? -- Posted via http://www.ruby-forum.com/.