| 410 | } |
| 411 | |
| 412 | CExtPubKey DecodeExtPubKey(const std::string& str) |
| 413 | { |
| 414 | CExtPubKey key; |
| 415 | std::vector<unsigned char> data; |
| 416 | if (DecodeBase58Check(str, data, 78)) { |
| 417 | const std::vector<unsigned char>& prefix = Params().Base58Prefix(CChainParams::EXT_PUBLIC_KEY); |
| 418 | if (data.size() == BIP32_EXTKEY_SIZE + prefix.size() && std::equal(prefix.begin(), prefix.end(), data.begin())) { |
| 419 | key.Decode(data.data() + prefix.size()); |
| 420 | } |
| 421 | } |
| 422 | return key; |
| 423 | } |
| 424 | |
| 425 | std::string EncodeExtPubKey(const CExtPubKey& key) |
| 426 | { |