Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- > Base84 distinguishes uppercase and lowercase letters, so different encoded names can compare equal on a case-insensitive filesystem.
I understand for the authors particular application the probability of collision is small, but this makes this encoding completely impractical for filenames generally.
by cmovq - Ridiculous and only tangentially related question, but.... is Base83 uniquely useful in any way?by chaps
- 27% more efficient than base32 at expense of all kind of weird compat issues with shell scripts, etc. Yikes!by killerstorm
- Meanwhile, Windows uses UTF-16 everywhere internally, so "a" and "あ" are both 2 bytes large. You'd still have to exclude surrogate pairs and the Unicode control characters from a filename.by Dwedit
- > How about case-insensitive filesystems? [...] Negligible.
I don't buy this. Finding collisions is pretty easy. In one repository I have these files:
The last two have the same case-insensitive Base84 encoding:rank2.cpp rank4.cpp rankN.cppmz{QkARW;1cB mz{QkaRW;1cBby teo_zero - > It emits groups of five characters. Five is the sweet spot: 84⁵ = 4,182,119,424, only 2.6% short of 2³².
> That leaves enough room for a group to hold 32 bits about 95% of the time on uniformly random input, and 31 bits otherwise.
> The encoder looks at the next 31 bits. If their value is below 84⁵ - 2³¹, there’s room for a 32nd bit. Otherwise, it consumes just those 31 bits. Either way, the value fits in five base-84 digits.
Seems pretty awkward.
by zahlman - The non-alphanumeric characters are just asking for trouble. Agents will fail to escape them correctly, and the $ could expand a variable.
Base62 (or 64, with -_) is totally sufficient.
by bensyverson - > Here’s the alphabet, in encoding order:
> ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&'()+,-;=@[]^_`{}~
Yeah I definitely don't want any of those last ~22 characters in file names if I need to do anything with them from a shell
by abound