def b32decode(source): if isinstance(source, unicode): source = source.encode('ascii') source = source.translate(_b32_translate) remainder = len(source) & 7 if remainder: source += _b32_decode_pad[:-remainder] return _b32decode(source, True)
def b32decode(source): """ wrapper around :func:`base64.b32decode` which handles common mistyped chars. padding optional, ignored if present. """ # encode & correct for typos if isinstance(source, unicode): source = source.encode("ascii") source = source.translate(_b32_translate) # pad things so final string is multiple of 8 remainder = len(source) & 0x7 if remainder: source += _b32_decode_pad[:-remainder] # XXX: py27 stdlib's version of this has some inefficiencies, # could look into using optimized version. return _b32decode(source, True)
def b32decode(string): trailing = len(string) % 8 if trailing: string = string + "=" * (8 - trailing) # Pad with = for b32decodes:s pleasure return _b32decode(string, True)
def b32decode(string): l = len(string) string = string + "="*(7-((l-1)%8)) # Pad with = for b32decodes:s pleasure return _b32decode(string, True)