keychain/utils.py
def bip32_deserialize(data):
    """
    Derived from code from pybitcointools (https://github.com/vbuterin/pybitcointools)
    by Vitalik Buterin
    """
    dbin = changebase(data, 58, 256)
    if bin_dbl_sha256(dbin[:-4])[:4] != dbin[-4:]:
        raise Exception("Invalid checksum")
    vbytes = dbin[0:4]
    depth = from_byte_to_int(dbin[4])
    fingerprint = dbin[5:9]
    i = decode(dbin[9:13], 256)
    chaincode = dbin[13:45]
    key = dbin[46:78]+b'\x01' if vbytes in PRIVATE else dbin[45:78]
    return (vbytes, depth, fingerprint, i, chaincode, key)
def bip32_deserialize(data):
    """
    Derived from code from pybitcointools (https://github.com/vbuterin/pybitcointools)
    by Vitalik Buterin
    """
    dbin = changebase(data, 58, 256)
    if bin_dbl_sha256(dbin[:-4])[:4] != dbin[-4:]:
        raise Exception("Invalid checksum")
    vbytes = dbin[0:4]
    depth = from_byte_to_int(dbin[4])
    fingerprint = dbin[5:9]
    i = decode(dbin[9:13], 256)
    chaincode = dbin[13:45]
    key = dbin[46:78]+b'\x01' if vbytes in PRIVATE else dbin[45:78]
    return (vbytes, depth, fingerprint, i, chaincode, key)
def bip32_deserialize ( data ) : dbin = changebase ( data , 58 , 256 ) if bin_dbl_sha256 ( dbin [ : - 4 ] ) [ : 4 ] != dbin [ - 4 : ] : raise Exception ( "Invalid checksum" ) vbytes = dbin [ 0 : 4 ] depth = from_byte_to_int ( dbin [ 4 ] ) fingerprint = dbin [ 5 : 9 ] i = decode ( dbin [ 9 : 13 ] , 256 ) chaincode = dbin [ 13 : 45 ] key = dbin [ 46 : 78 ] + b'\x01' if vbytes in PRIVATE else dbin [ 45 : 78 ] return ( vbytes , depth , fingerprint , i , chaincode , key )
Derived from code from pybitcointools (https://github.com/vbuterin/pybitcointools)
    by Vitalik Buterin
Derived from code from pybitcointools ( https : // github . com / vbuterin / pybitcointools ) by Vitalik Buterin