MCPcopy Create free account
hub / github.com/LUX-Core/lux / SignCompact

Method SignCompact

src/key.cpp:229–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229bool CKey::SignCompact(const uint256& hash, std::vector<uint8_t>& vchSig) const {
230 if (!fValid)
231 return false;
232 vchSig.resize(CPubKey::COMPACT_SIGNATURE_SIZE);
233 int rec = -1;
234 secp256k1_ecdsa_recoverable_signature sig;
235 int ret = secp256k1_ecdsa_sign_recoverable(secp256k1_context_sign, &sig, hash.begin(), begin(), secp256k1_nonce_function_rfc6979, nullptr);
236 assert(ret);
237 secp256k1_ecdsa_recoverable_signature_serialize_compact(secp256k1_context_sign, (unsigned char*)&vchSig[1], &rec, &sig);
238 assert(ret);
239 assert(rec != -1);
240 vchSig[0] = 27 + rec + (fCompressed ? 4 : 0);
241 return true;
242}
243
244bool CKey::Load(const CPrivKey& privkey, const CPubKey& vchPubKey, bool fSkipCheck = false) {
245 if (!ec_privkey_import_der(secp256k1_context_sign, (unsigned char*)begin(), privkey.data(), privkey.size()))

Callers 4

signmessageFunction · 0.80
SignMessageMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 5

beginFunction · 0.85
resizeMethod · 0.45
beginMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64