Skip to content

Instantly share code, notes, and snippets.

@kjd
Created Jun 29, 2009
Embed
What would you like to do?
#!/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