If you used a Base62 algorithm, then you can simply increase the value
by one for the next url. I assume that Twitter did this for security
reasons, just like bit.ly.


On 8/13/10 3:55 PM, Nik Fletcher wrote:
> I don't know how Twitter are shortening the URLs.
> However. IIRC Twitter's shortener is designed to always use 20
> characters (I believe) so that as developers we can pass in full URLs
> knowing how much space each URL will take up in a tweet and show the
> character count accordingly. Matt / Taylor might be able to comment
> further though.
> -N
> --
> Nik Fletcher
> @nikf
> On Aug 13, 2:17 am, "D. Smith" <emai...@sharedlog.com> wrote:
>> How long has it been since Twitter started their own t.com url
>> shortener? Not sure, but I don't think it's been long enough to
>> shorten over 3.5 trillion urls.
>> Well, I just noticed that the the url "shortened" by t.com was
>> this:http://t.co/5ywZYau
>> So the value is 5ywZYau
>> From what I understand the shorteners work this way (at least this is
>> the most effecient way in order to create as short a url as possible):
>> First you create a new record for url and get the next available
>> numeric id, usually auto increment. Then you use base62 encoding to
>> convert this integer into a string. The result is that you get the
>> shortest possible value consisting of lower and upper case english
>> letters plus 10 numbers, thus a total of 62 chars are used.
>> The number of chars needed to represent a value is 62 x 62 x 62,
>> etc... so the 7 chars-long base 62 string can represent a number over
>> 13 digits long.
>> Ok, so is it really possible for this service to already shorten over
>> a trillion urls? I don't think so. which only means that you are not
>> doing your best to make the shortest possible url. What's the point of
>> registering a one-letter top level domain, going through all the
>> trouble of creating your own service and then not really doing your
>> absolute best to make sure urls are as short as possible. I mean, you
>> could have probably still be using 4, maybe 5 - chars long codes
>> instead of 7, saving potential customers 2 or 3 valuable characters

Reply via email to