Hacker News new | ask | show | jobs
by andfarm 5507 days ago
I'm having trouble thinking of any situations where you're free to use any alphanumerics, but you absolutely can't use anything else. The closest thing that comes to mind is DNS, and that's a 36-character set, not 62.

Ascii85 (http://en.wikipedia.org/wiki/Base85) uses a similar concept, but using the majority of the printable ASCII characters. It gets a hard-to-beat 20% expansion on binary data (4 bytes in 5 chars) without requiring bigint math.

3 comments

You're right on DNS, I was not thinking clearly when I wrote that part. I will fix up the article.

The prime scenario that caused me to think about this problem is indeed URL components, and in particular object identifies for RESTful protocols.

The other thing I was thinking about were cookies values, which I have had problems with in the past.

EDIT: The most annoying part about base64 is that different systems have different restrictions. With Maze62 I won't have to think about which system my data will end up in.

I'm pretty sure the canonical use case for this would be for including complex binary data in a URL. A URL shortener might be a good example.
Another thing people don't talk much about is copy-paste. Double click on an alphanumeric will select the entire thing, whereas other characters might cause selection to end prematurely, and differently so in different text editors.
.

_