Created
June 29, 2009 07:08
-
-
Save kjd/137507 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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