(b58_s)
return version_byte, encoded_value, checksum
Takes in a base 58 check string and returns: the version byte, the
        original encoded binary string, and the checksum.
Takes in a base 58 check string and returns: the version byte, the
        original encoded binary string, and the checksum.
Takes in a base 58 check string and returns : the version byte the original encoded binary string and the checksum .
def b58check_unpack(b58_s):
    """ Takes in a base 58 check string and returns: the version byte, the
        original encoded binary string, and the checksum.
    """
    num_leading_zeros = len(re.match(r'^1*', b58_s).group(0))
    # convert from b58 to b16
    hex_s = change_charset(b58_s, B58_KEYSPACE, HEX_KEYSPACE)
    # convert from b16 to b2
    bin_s = binascii.unhexlify(hex_s)
    # add in the leading zeros
    bin_s = '\x00' * num_leading_zeros + bin_s
    # make sure the newly calculated checksum equals the embedded checksum
    newly_calculated_checksum = bin_checksum(bin_s[:-4])
    embedded_checksum = bin_s[-4:]
    assert(newly_calculated_checksum == embedded_checksum)    
    # return values
    version_byte = bin_s[:1]
    encoded_value = bin_s[1:-4]
    checksum = bin_s[-4:]
    return version_byte, encoded_value, checksum
def b58check_unpack ( b58_s ) : num_leading_zeros = len ( re . match ( r'^1*' , b58_s ) . group ( 0 ) ) # convert from b58 to b16 hex_s = change_charset ( b58_s , B58_KEYSPACE , HEX_KEYSPACE ) # convert from b16 to b2 bin_s = binascii . unhexlify ( hex_s ) # add in the leading zeros bin_s = '\x00' * num_leading_zeros + bin_s # make sure the newly calculated checksum equals the embedded checksum newly_calculated_checksum = bin_checksum ( bin_s [ : - 4 ] ) embedded_checksum = bin_s [ - 4 : ] assert ( newly_calculated_checksum == embedded_checksum ) # return values version_byte = bin_s [ : 1 ] encoded_value = bin_s [ 1 : - 4 ] checksum = bin_s [ - 4 : ] return version_byte , encoded_value , checksum