MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / SetString

Method SetString

src/commons/base58.cpp:155–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155bool CBase58Data::SetString(const char* psz, unsigned int nVersionBytes) {
156 vector<unsigned char> vchTemp;
157 DecodeBase58Check(psz, vchTemp);
158 if (vchTemp.size() < nVersionBytes) {
159 vchData.clear();
160 vchVersion.clear();
161 return false;
162 }
163 vchVersion.assign(vchTemp.begin(), vchTemp.begin() + nVersionBytes);
164 vchData.resize(vchTemp.size() - nVersionBytes);
165 if (!vchData.empty())
166 memcpy(&vchData[0], &vchTemp[nVersionBytes], vchData.size());
167 OPENSSL_cleanse(&vchTemp[0], vchData.size());
168 return true;
169}
170
171bool CBase58Data::SetString(const string& str) {
172 return SetString(str.c_str());

Callers 9

BOOST_AUTO_TEST_CASEFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
getsignatureFunction · 0.80
CommonTxGeneratorFunction · 0.80
ContractTxGeneratorFunction · 0.80
WasmTxGeneratorFunction · 0.80
importprivkeyFunction · 0.80
ParseUidInTableFunction · 0.80

Calls 7

DecodeBase58CheckFunction · 0.85
memcpyFunction · 0.85
sizeMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
resizeMethod · 0.45
emptyMethod · 0.45

Tested by 3

BOOST_AUTO_TEST_CASEFunction · 0.64
BOOST_AUTO_TEST_CASEFunction · 0.64
BOOST_AUTO_TEST_CASEFunction · 0.64