1 from base64 import b32encode, b32decode
4 assert isinstance(i, str), "tried to idlib.b2a non-string '%s'" % (i,)
5 return b32encode(i).lower()
13 assert isinstance(i, str), "tried to idlib.a2b non-string '%s'" % (i,)
15 return b32decode(i.upper())
17 print "b32decode failed on a %s byte string '%s'" % (len(i), i)
21 def peerid_to_short_string(peerid):
22 return b2a(peerid)[:4]