Example #1
0
def bin_to_b40(s):
    if not isinstance(s, str):
        raise ValueError('%s must be a string' % s)
    return hex_to_charset(hexlify(s), B40_CHARS)
Example #2
0
 def test_hex_to_charset(self):
     s = "d9fa02e46cd3867f51279dfae592d3706022ee93c175b49c30c8c962722fc890"
     s2 = hex_to_charset(s, string.digits)
     self.assertTrue(is_valid_int(s2))