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.
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.
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 - #