sametmax/0bin — pull request #42 by mk-fg (2013-04-29 19:17:40+00:00)
Title: Shorter urls

Instead of this:

http://some.0bin.site/paste/9611846d1c86e549fabe205837d40b780f5efce3#bLilFEQok1qTOzifX2gdvZO1ZoHki1getSt/YnAdAFQ=

Produce this:

http://some.0bin.site/paste/FxsUsOGB#aW8DhwMy

6eec295 changes how paste-ids are generated - instead of base16 hexdigest, base64-like (with "/" replaced with "-" to produce less confusing urls and require no special fs-path conversion) ids of configurable length are used.

Adds new PASTE_ID_LENGTH option:

# length of base64-like paste-id string in the url, max: 27 (length of sha1 digest)
# total number of unique pastes can be calculated as 2^(6*PASTE_ID_LENGTH)
# for PASTE_ID_LENGTH=8, for example, it's 2^(6*8) = 281 474 976 710 656
PASTE_ID_LENGTH = 8

It's currently not mentioned in the doc, but if you see no problem with these commits, I can easily fix this (or you can, if you intend to update fr doc alongside anyway - just one option).

As mentioned in the default_settings.py, with 8 base64 (6-bit) chars, number of possible pastes should be `2^(6*8) = 281 474 976 710 656`, which I think should suffice to keep ids unique.

All old pastes should still be accessible under long old-style ids, while new ones will be shorter.