James Britt wrote:

> Nice.  I noticed, though, that you do not get the same rubyURL for the
> same source URL each time you do a conversion.    I'm guessing then
> there is no straightforward has mapping going on.

In my little IOWA based system, I just do a query back to the database when
one enters a URL.  If there is already a short version available, one is
informed of what the already existing URL is.  The expense of a query here,
when entering a URL into the system, is minimal.

> away).  For example, if you see this:
>    http://rubyurl.com/2OJCU
> 
> you should be able to reverse-engineer it to this
>    http://www.ruby-doc.org/

2OJCU does not have all of the information in it that www.ruby-doc.org does. 
Hashing algorithms like that are one way encodings.

General philosophical question about these sorts of services.  What is the
advantage of using a hashing algorithm over some sort of simple counter?

My implementation just uses a count, expressed as a base62 number.  So, even
with a very, very large number of URLs in the database, the URLs will still
stay quite short, and if one has the disk space, one need never purge or
overwrite a URL as can happen when there are hashing algorithm collisions.

I suppose the downside is just that this makes it easy for someone to scan
the database of URLs?


Kirk Haines