Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

Changeset 8162. “Implemented a secure password reset form that uses a token and prompts user for new password”—also sneaks base36 encoding and decoding in to Django.

3 comments

  1. Any love for base62?

    Vezquex - 1st August 2008 13:09 - #

  2. That's great news. You just have to love a web framework that throws in base36 support. But like Vezquex, I'm thinking it sure would be nice to see base62 as well.

    Scott Johnson - 1st August 2008 15:51 - #

  3. I think I can shed some light on the Base-36 decision. Python supports converting a string in base-36 to base-10 int. All you have to do is:

    >>>x = int('RS', 36)
    >>>x
    1000

    If you want base-62 capabilities, you have to actually write a converter yourself. It isn't that hard (and if I remember I'll link to code I've written before).

    The other issue is that base-62 becomes case-sensitive. Base-36 might fail with capital letters, but Base-62 will give you wrong stuff. I don't see it as a big issue, but programming languages have shied away from going there - ruby also goes up to 36.

    And there isn't a huge need for base-62. Base-36 with 8 characters goes above 2.8 trillion. Google's URL index is 1 trillion URLs. Plus, at that point, is a 9th digit so bad?

    I don't have strong opinions. Clearly I value base-62 since I've written code to handle it, but I don't see a hugely compelling argument for it.

    Sean - 1st August 2008 17:33 - #

Sign in with OpenID

Auto-HTML: Line breaks are preserved; URLs will be converted in to links.

Manual XHTML: Enter your own, valid XHTML. Allowed tags are a, p, blockquote, ul, ol, li, dl, dt, dd, em, strong, dfn, code, q, samp, kbd, var, cite, abbr, acronym, sub, sup, br, pre

A django site