python类b58encode()的实例源码

data_objects.py 文件源码 项目:oldchain-client 作者: mediachain 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def multihash_base58(self):
        return b58encode(self.multihash)
utils.py 文件源码 项目:oldchain-client 作者: mediachain 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def ref_base58(ref):
    ref_str = ref
    try:
        ref_str = ref.multihash_base58()
    except AttributeError:
        pass
    try:
        ref_str = ref.reference
    except AttributeError:
        pass
    try:
        ref_str = base58.b58encode(ref['@link'])
    except (KeyError, ValueError, TypeError):
        pass
    return ref_str
client.py 文件源码 项目:indy-client 作者: hyperledger-archives 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def doAttrDisclose(self, origin, target, txnId, key):
        box = libnacl.public.Box(b58decode(origin), b58decode(target))

        data = json.dumps({TXN_ID: txnId, SKEY: key})
        nonce, boxedMsg = box.encrypt(data.encode(), pack_nonce=False)

        op = {
            TARGET_NYM: target,
            TXN_TYPE: DISCLO,
            NONCE: b58encode(nonce),
            DATA: b58encode(boxedMsg)
        }
        self.submit(op, identifier=origin)
conftest.py 文件源码 项目:indy-client 作者: hyperledger-archives 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def client1Signer():
    seed = b'client1Signer secret key........'
    signer = DidSigner(seed=seed)
    testable_verkey = friendlyToRaw(signer.identifier)
    testable_verkey += friendlyToRaw(signer.verkey[1:])
    testable_verkey = base58.b58encode(testable_verkey)
    assert testable_verkey == '6JvpZp2haQgisbXEXE9NE6n3Tuv77MZb5HdF9jS5qY8m'
    return signer
Helper.py 文件源码 项目:neo-python 作者: CityOfZion 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def hash_to_wallet_address(ba, address_version=23):
    sb = bytearray([23]) + ba
    c256 = bin_dbl_sha256(sb)[0:4]
    outb = sb + bytearray(c256)
    return base58.b58encode(bytes(outb))
client.py 文件源码 项目:indy-node 作者: hyperledger 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def doAttrDisclose(self, origin, target, txnId, key):
        box = libnacl.public.Box(b58decode(origin), b58decode(target))

        data = json.dumps({TXN_ID: txnId, SKEY: key})
        nonce, boxedMsg = box.encrypt(data.encode(), pack_nonce=False)

        op = {
            TARGET_NYM: target,
            TXN_TYPE: DISCLO,
            NONCE: b58encode(nonce),
            DATA: b58encode(boxedMsg)
        }
        self.submit(op, identifier=origin)
conftest.py 文件源码 项目:indy-node 作者: hyperledger 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def client1Signer():
    seed = b'client1Signer secret key........'
    signer = DidSigner(seed=seed)
    testable_verkey = friendlyToRaw(signer.identifier)
    testable_verkey += friendlyToRaw(signer.verkey[1:])
    testable_verkey = base58.b58encode(testable_verkey)
    assert testable_verkey == '6JvpZp2haQgisbXEXE9NE6n3Tuv77MZb5HdF9jS5qY8m'
    return signer
conftest.py 文件源码 项目:indy-node 作者: hyperledger 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def noKeyIdr(wallet):
    idr = base58.b58encode(b'1' * 16)
    return wallet.addIdentifier(identifier=idr)[0]
conftest.py 文件源码 项目:indy-node 作者: hyperledger 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def fullKeyIdr(wallet):
    idr = base58.b58encode(b'2' * 16)
    return wallet.addIdentifier(identifier=idr)[0]
models.py 文件源码 项目:rudi 作者: lexxodus 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def create_code(self):
        if self.code:
            raise FieldError
        hash_input = (
            "fim_rudi" + self.participant_1_email +
            str(time.clock()) +
            str(self.event) +
            str(random.random()))
        digest = sha256(hash_input).digest()
        # if code already exists create another
        new_code = base58.b58encode(digest)
        if Team.objects.filter(code=new_code).exists():
            return self.create_code()
        self.code = new_code
wallet.py 文件源码 项目:bitcoin_tools 作者: sr-gi 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def hash_160_to_btc_address(h160, v):
    """ Calculates the Bitcoin address of a given RIPEMD-160 hash from an elliptic curve public key.

    :param h160: RIPEMD-160 hash.
    :type h160: bytes
    :param v: version (prefix) used to calculate the Bitcoin address.

     Possible values:

        - 0 for main network (PUBKEY_HASH).
        - 111 For testnet (TESTNET_PUBKEY_HASH).
    :type v: int
    :return: The corresponding Bitcoin address.
    :rtype: hex str
    """

    # If h160 is passed as hex str, the value is converted into bytes.
    if match('^[0-9a-fA-F]*$', h160):
        h160 = unhexlify(h160)

    # Add the network version leading the previously calculated RIPEMD-160 hash.
    vh160 = chr(v) + h160
    # Double sha256.
    h = sha256(sha256(vh160).digest()).digest()
    # Add the two first bytes of the result as a checksum tailing the RIPEMD-160 hash.
    addr = vh160 + h[0:4]
    # Obtain the Bitcoin address by Base58 encoding the result
    addr = b58encode(addr)

    return addr
Helper.py 文件源码 项目:sync_antshares 作者: OTCGO 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def hexPrivateKey_to_WIFkey(hpk):
    bpk = hexPrivateKey_to_binPrivateKey(hpk)
    if len(bpk) != 32:
        print 'Error'
        return None
    wif = '\x80' + bpk + '\x01'
    wif = wif + hashlib.sha256(hashlib.sha256(wif).digest()).digest()[0:4]
    wif = b58encode(wif)
    return wif
goofy.py 文件源码 项目:goofycoin 作者: homeowmorphism 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def generate_coin_id(self):
        coin_id = str(random.getrandbits(settings.coin_id_size))
        coin_id = base58.b58encode(coin_id.encode())
        return coin_id
client.py 文件源码 项目:old-sovrin 作者: sovrin-foundation 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def doAttrDisclose(self, origin, target, txnId, key):
        box = libnacl.public.Box(b58decode(origin), b58decode(target))

        data = json.dumps({TXN_ID: txnId, SKEY: key})
        nonce, boxedMsg = box.encrypt(data.encode(), pack_nonce=False)

        op = {
            TARGET_NYM: target,
            TXN_TYPE: DISCLO,
            NONCE: b58encode(nonce),
            DATA: b58encode(boxedMsg)
        }
        self.submit(op, identifier=origin)
conftest.py 文件源码 项目:old-sovrin 作者: sovrin-foundation 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def noKeyIdr(wallet):
    idr = base58.b58encode(b'1'*16)
    return wallet.addIdentifier(identifier=idr)[0]
conftest.py 文件源码 项目:old-sovrin 作者: sovrin-foundation 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def fullKeyIdr(wallet):
    idr = base58.b58encode(b'2'*16)
    return wallet.addIdentifier(identifier=idr)[0]
ed25519.py 文件源码 项目:cryptoconditions 作者: bigchaindb 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def to_dict(self):
        """
        Generate a dict of the fulfillment

        Returns:
            dict: representing the fulfillment
        """
        return {
            'type': Ed25519Sha256.TYPE_NAME,
            'public_key': base58.b58encode(self.public_key),
            'signature': base58.b58encode(self.signature) if self.signature else None
        }

    # TODO Adapt according to outcomes of
    # https://github.com/rfcs/crypto-conditions/issues/16
condition.py 文件源码 项目:cryptoconditions 作者: bigchaindb 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def to_dict(self):
        """Generate a dict of the condition

        Returns:
            dict: representing the condition

        """
        return {
            'type_id': self.type_id,
            'hash': base58.b58encode(self.hash),
            'cost': self.cost,
            'subtypes': self.subtypes,
        }
crypto.py 文件源码 项目:cryptoconditions 作者: bigchaindb 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def encode(data):
        return base58.b58encode(data).encode()
utils.py 文件源码 项目:indy-anoncreds 作者: hyperledger 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def base58encode(i):
    return base58.b58encode(str(i).encode())


问题


面经


文章

微信
公众号

扫码关注公众号