URL shortening codes from a random number generator
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
short_codes.py

README.md

shortcodes

This implements URL shortening codes from a random number generator, written in Python.

For more details on what this code is doing, see this blog post.

Usage

If you have a 1-up counter, you can get back a scrambled short code (5 base32 digits), and recover the counter value from the scrambled code like so:

>>> import short_codes
>>> short_codes.short_code(123)
'K8$PN'

>>> short_codes.deshort_code('K8$PN')
123

License

MIT. See LICENSE.