Guy Rutenberg

Keeping track of what I do

Archive for the ‘Snippets’ tag

URL-Safe Timestamps using Base64

without comments

Passing around timestamps in URLs is a common task. We usually want our URLs to be as shortest as possible. I’ve found using Base64 to result in the shortest URL-safe representation, just 6 chars. This compares with the 12 chars of the naive way, and 8 chars when using hex representation.

The following Python functions allow you to build and read these 6 chars URL-safe timestamps:
Read the rest of this entry »

Written by Guy

April 30th, 2010 at 8:08 pm

Posted in Tips

Tagged with , ,