validate.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:bitencrypt 作者: OriginalMy 项目源码 文件源码
def netcode_and_type_for_text(text):
    # check for "public pair"
    try:
        LENGTH_LOOKUP = {
            33: "public_pair",
            65: "public_pair",
            16: "elc_seed",
            32: "elc_prv",
            64: "elc_pub",
        }
        as_bin = h2b(text)
        l = len(as_bin)
        if l in LENGTH_LOOKUP:
            return None, LENGTH_LOOKUP[l], as_bin
    except (binascii.Error, TypeError):
        pass

    data = encoding.a2b_hashed_base58(text)
    netcode, the_type = netcode_and_type_for_data(data)
    length = 1 if the_type in ["wif", "address"] else 4
    return netcode, the_type, data[length:]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号