How to use base58 - 10 common examples

To help you get started, we’ve selected a few base58 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bigchaindb / bigchaindb / tests / common / test_transaction.py View on Github external
def test_output_deserialization(user_Ed25519, user_pub):
    from bigchaindb.common.transaction import Output

    expected = Output(user_Ed25519, [user_pub], 1)
    cond = {
        'condition': {
            'uri': user_Ed25519.condition_uri,
            'details': {
                'type': 'ed25519-sha-256',
                'public_key': b58encode(user_Ed25519.public_key).decode(),
            },
        },
        'public_keys': [user_pub],
        'amount': '1',
    }
    cond = Output.from_dict(cond)

    assert cond == expected
github keis / base58 / test_base58.py View on Github external
def test_autofix_not_applicable_check_str():
    charset = BITCOIN_ALPHABET.replace(b'x', b'l')
    msg = b'hello world'
    enc = b58encode_check(msg).replace(b'x', b'l').replace(b'o', b'0')
    back = b58decode_check(enc, alphabet=charset, autofix=True)
    assert_that(back, equal_to(msg))
github AdvancedTechnologyCoin / arc_core / contrib / testgen / gen_base58_test_vectors.py View on Github external
def is_valid(v):
    '''Check vector v for validity'''
    result = b58decode_chk(v)
    if result is None:
        return False
    valid = False
    for template in templates:
        prefix = str(bytearray(template[0]))
        suffix = str(bytearray(template[2]))
        if result.startswith(prefix) and result.endswith(suffix):
            if (len(result) - len(prefix) - len(suffix)) == template[1]:
                return True
    return False
github Pigeoncoin / pigeoncoin / contrib / testgen / gen_base58_test_vectors.py View on Github external
def is_valid(v):
    '''Check vector v for validity'''
    result = b58decode_chk(v)
    if result is None:
        return False
    for template in templates:
        prefix = str(bytearray(template[0]))
        suffix = str(bytearray(template[2]))
        if result.startswith(prefix) and result.endswith(suffix):
            if (len(result) - len(prefix) - len(suffix)) == template[1]:
                return True
    return False
github MFrcoin / MFCoin / contrib / testgen / gen_base58_test_vectors.py View on Github external
def is_valid(v):
    '''Check vector v for validity'''
    result = b58decode_chk(v)
    if result is None:
        return False
    for template in templates:
        prefix = str(bytearray(template[0]))
        suffix = str(bytearray(template[2]))
        if result.startswith(prefix) and result.endswith(suffix):
            if (len(result) - len(prefix) - len(suffix)) == template[1]:
                return True
    return False
github BTCPrivate / BTCP-Rebase / contrib / testgen / gen_base58_test_vectors.py View on Github external
def is_valid(v):
    '''Check vector v for validity'''
    result = b58decode_chk(v)
    if result is None:
        return False
    valid = False
    for template in templates:
        prefix = str(bytearray(template[0]))
        suffix = str(bytearray(template[2]))
        if result.startswith(prefix) and result.endswith(suffix):
            if (len(result) - len(prefix) - len(suffix)) == template[1]:
                return True
    return False
github CommerciumBlockchain / Commercium_Deprecated / contrib / testgen / gen_base58_test_vectors.py View on Github external
def is_valid(v):
    '''Check vector v for validity'''
    result = b58decode_chk(v)
    if result is None:
        return False
    for template in templates:
        prefix = str(bytearray(template[0]))
        suffix = str(bytearray(template[2]))
        if result.startswith(prefix) and result.endswith(suffix):
            if (len(result) - len(prefix) - len(suffix)) == template[1]:
                return True
    return False
github project-bitmark / bitmark / contrib / testgen / gen_base58_test_vectors.py View on Github external
def is_valid(v):
    '''Check vector v for validity'''
    result = b58decode_chk(v)
    if result is None:
        return False
    valid = False
    for template in templates:
        prefix = str(bytearray(template[0]))
        suffix = str(bytearray(template[2]))
        if result.startswith(prefix) and result.endswith(suffix):
            if (len(result) - len(prefix) - len(suffix)) == template[1]:
                return True
    return False
github machinecoin-project / machinecoin-core / contrib / testgen / gen_base58_test_vectors.py View on Github external
def is_valid(v):
    '''Check vector v for validity'''
    result = b58decode_chk(v)
    if result is None:
        return False
    for template in templates:
        prefix = str(bytearray(template[0]))
        suffix = str(bytearray(template[2]))
        if result.startswith(prefix) and result.endswith(suffix):
            if (len(result) - len(prefix) - len(suffix)) == template[1]:
                return True
    return False
github CommerciumBlockchain / Commercium_Deprecated / contrib / testgen / gen_base58_test_vectors.py View on Github external
if corrupt_prefix:
        prefix = os.urandom(1)
    else:
        prefix = str(bytearray(template[0]))
    
    if randomize_payload_size:
        payload = os.urandom(max(int(random.expovariate(0.5)), 50))
    else:
        payload = os.urandom(template[1])
    
    if corrupt_suffix:
        suffix = os.urandom(len(template[2]))
    else:
        suffix = str(bytearray(template[2]))

    return b58encode_chk(prefix + payload + suffix)