Skip to content

Instantly share code, notes, and snippets.

@kjd
Created June 29, 2009 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjd/137507 to your computer and use it in GitHub Desktop.
Save kjd/137507 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#
# Base 58 function used by Flickr e.g. photo id 2360374815 becomes flic.kr/p/4Azxcv
def base58(i):
chars = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
o = ''
while (1):
o = chars[i % 58] + o
i = i / 58
if i == 0:
break
return o
# print base58(2360374815)
# 4Azxcv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment