| 359 | } |
| 360 | |
| 361 | void CExtPubKey::Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const { |
| 362 | code[0] = nDepth; |
| 363 | memcpy(code+1, vchFingerprint, 4); |
| 364 | WriteBE32(code+5, nChild); |
| 365 | memcpy(code+9, chaincode.begin(), 32); |
| 366 | assert(pubkey.size() == CPubKey::COMPRESSED_SIZE); |
| 367 | memcpy(code+41, pubkey.begin(), CPubKey::COMPRESSED_SIZE); |
| 368 | } |
| 369 | |
| 370 | void CExtPubKey::Decode(const unsigned char code[BIP32_EXTKEY_SIZE]) { |
| 371 | nDepth = code[0]; |