MCPcopy Create free account
hub / github.com/ElementsProject/elements / DecodeSecret

Function DecodeSecret

src/key_io.cpp:381–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379} // namespace
380
381CKey DecodeSecret(const std::string& str)
382{
383 CKey key;
384 std::vector<unsigned char> data;
385 if (DecodeBase58Check(str, data, 34)) {
386 const std::vector<unsigned char>& privkey_prefix = Params().Base58Prefix(CChainParams::SECRET_KEY);
387 if ((data.size() == 32 + privkey_prefix.size() || (data.size() == 33 + privkey_prefix.size() && data.back() == 1)) &&
388 std::equal(privkey_prefix.begin(), privkey_prefix.end(), data.begin())) {
389 bool compressed = data.size() == 33 + privkey_prefix.size();
390 key.Set(data.begin() + privkey_prefix.size(), data.begin() + privkey_prefix.size() + 32, compressed);
391 }
392 }
393 if (!data.empty()) {
394 memory_cleanse(data.data(), data.size());
395 }
396 return key;
397}
398
399std::string EncodeSecret(const CKey& key)
400{

Callers 15

MutateTxSignFunction · 0.85
importprivkeyFunction · 0.85
importwalletFunction · 0.85
ProcessImportLegacyFunction · 0.85
ProcessImportDescriptorFunction · 0.85
sethdseedFunction · 0.85
generatepegoutproofFunction · 0.85
getpegoutkeysFunction · 0.85
ParsePubkeyInnerFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 9

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

Tested by 5

BOOST_AUTO_TEST_CASEFunction · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68
FUZZ_TARGET_INITFunction · 0.68
FUZZ_TARGET_INITFunction · 0.68