MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / DecodeExtKey

Function DecodeExtKey

src/key_io.cpp:268–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266}
267
268CExtKey DecodeExtKey(const std::string& str)
269{
270 CExtKey key;
271 std::vector<unsigned char> data;
272 if (DecodeBase58Check(str, data, 78)) {
273 const std::vector<unsigned char>& prefix = Params().Base58Prefix(CChainParams::EXT_SECRET_KEY);
274 if (data.size() == BIP32_EXTKEY_SIZE + prefix.size() && std::equal(prefix.begin(), prefix.end(), data.begin())) {
275 key.Decode(data.data() + prefix.size());
276 }
277 }
278 if (!data.empty()) {
279 memory_cleanse(data.data(), data.size());
280 }
281 return key;
282}
283
284std::string EncodeExtKey(const CExtKey& key)
285{

Callers 5

addhdkeyFunction · 0.85
ParsePubkeyInnerFunction · 0.85
RunTestFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
key_io.cppFile · 0.85

Calls 9

DecodeBase58CheckFunction · 0.85
memory_cleanseFunction · 0.85
ParamsClass · 0.70
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
DecodeMethod · 0.45
dataMethod · 0.45
emptyMethod · 0.45

Tested by 2

RunTestFunction · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68