Slug: newbase60 Date: 2010-05-28 Title: TinWhistle (was NewBase60) layout: post
Apropos of my recent interview with Tantek Çelik about URL shorteners, I’ve ported his NewBase60 code (part of his CASSIS project) to perl. It’s now found on github at http://github.com/sivy/TinWhistle. This code converts numbers (in this case, dates expressed as days-since-the-epoch) into a base60 (sexagesimal) representation that’s really short. For example, ‘1971-06-29’ becomes ‘94’, and ‘2010-05-26’ becomes ‘45v’.
As described in the interview, this value is used in conjunction with some other bits to create a reversible short URL - meaning that anyone following the algorithm described in that post should be able to derive the URL from the shortlink, and not be dependent on a particular service to resolve them.
This code is pretty complete and converts from DateTime to days-since-epoch, ordinal dates (YYYY-DDD, see the readme), and sexagesimal days.
I’ve expanded the code and moved it to a new project name. I’ve implemented a URL shortener called TinWhistle (roughly based on Tantek’s Whistle) that uses NewBase60, and of which NewBase60 is now a sub-component.