@classmethod<EOL><INDENT>def create_from_intermediate(cls, crypto, intermediate_point, seed, compressed=True, include_cfrm=True):<DEDENT>
flagbyte = b'<STR_LIT>' if compressed else b'<STR_LIT:\x00>'<EOL>payload = b58decode_check(str(intermediate_point))<EOL>ownerentropy = payload[<NUM_LIT:8>:<NUM_LIT:16>]<EOL>passpoint = payload[<NUM_LIT:16>:-<NUM_LIT:4>]<EOL>x, y = uncompress(passpoint)<EOL>if not is_py2:<EOL><INDENT>seed = bytes(seed, '<STR_LIT:ascii>')<EOL><DEDENT>seedb = hexlify(sha256(seed).digest())[:<NUM_LIT>]<EOL>factorb = int(hexlify(sha256(sha256(seedb).digest()).digest()), <NUM_LIT:16>)<EOL>generatedaddress = pubtoaddr(fast_multiply((x, y), factorb))<EOL>wrap = lambda x: x<EOL>if not is_py2:<EOL><INDENT>wrap = lambda x: bytes(x, '<STR_LIT:ascii>')<EOL><DEDENT>addresshash = sha256(sha256(wrap(generatedaddress)).digest()).digest()[:<NUM_LIT:4>]<EOL>encrypted_seedb = scrypt.hash(passpoint, addresshash + ownerentropy, <NUM_LIT>, <NUM_LIT:1>, <NUM_LIT:1>, <NUM_LIT:64>)<EOL>derivedhalf1, derivedhalf2 = encrypted_seedb[:<NUM_LIT:32>], encrypted_seedb[<NUM_LIT:32>:]<EOL>aes = AES.new(derivedhalf2)<EOL>block1 = long(seedb[<NUM_LIT:0>:<NUM_LIT:16>], <NUM_LIT:16>) ^ long(hexlify(derivedhalf1[<NUM_LIT:0>:<NUM_LIT:16>]), <NUM_LIT:16>)<EOL>encryptedpart1 = aes.encrypt(unhexlify('<STR_LIT>' % block1))<EOL>block2 = long(hexlify(encryptedpart1[<NUM_LIT:8>:<NUM_LIT:16>]) + seedb[<NUM_LIT:16>:<NUM_LIT>], <NUM_LIT:16>) ^ long(hexlify(derivedhalf1[<NUM_LIT:16>:<NUM_LIT:32>]), <NUM_LIT:16>)<EOL>encryptedpart2 = aes.encrypt(unhexlify('<STR_LIT>' % block2))<EOL>payload = b"<STR_LIT>" + flagbyte + addresshash + ownerentropy + encryptedpart1[:<NUM_LIT:8>] + encryptedpart2<EOL>encrypted_pk = b58encode_check(payload)<EOL>if not include_cfrm:<EOL><INDENT>return generatedaddress, encrypted_pk<EOL><DEDENT>confirmation_code = Bip38ConfirmationCode.create(flagbyte, ownerentropy, factorb, derivedhalf1, derivedhalf2, addresshash)<EOL>return generatedaddress, cls(crypto, encrypted_pk), confirmation_code<EOL>
Given an intermediate point, given to us by "owner", generate an address
and encrypted private key that can be decoded by the passphrase used to generate
the intermediate point.