Cool!

It is a nice companion to my 8 byte "pretty much unique" generator
[1], and could be integrated in my friendly URLs :).

However, I couldn't prove the case insensitivity of Base36, the
#toNumber: ignores characters not present in the Characters array. I
fixed Base36 toNumber: but broke Base62 tests :)

self assert: (Base36 toNumber: (Base36 fromNumber: 16) asUppercase)

will fail.

Regards,

--
Esteban.

[1] https://gist.github.com/eMaringolo/be973dcf03b0783711f1






Esteban A. Maringolo


2014-06-12 8:16 GMT-03:00 Norbert Hartl <norb...@hartl.name>:
> Hmm *cough*
>
> http://smalltalkhub.com/#!/~NorbertHartl/Base62
>
>
> Norbert
>
> Am 12.06.2014 um 13:12 schrieb Norbert Hartl <norb...@hartl.name>:
>
> Just for the record. I’ve uploaded a package to smalltalkhub that contains
> util classes to en-/decode values into/from Base62/Base36.
>
> Base62/Base36 encode numbers in short strings. These are used e.g. by url
> shortener services from google, bit.ly etc.
>
> Base36 uses lowercase letters and numbers to encode, Base62 uses all
> characters from Base36 plus all uppercase letters. Base62 produces smaller
> strings while Base36 produces case insensitive ones.
>
> Example:
>
> Base62 fromNumber: 100000 -> 'q0U‘
>
> Base36 fromNumber: 100000 -> ‚255s'
>
> FYI,
>
> Norbert
>
>
>

Reply via email to