MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / SignCompact

Method SignCompact

src/key.cpp:315–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315bool CKey::SignCompact(const uint256 &hash,
316 std::vector<uint8_t> &vchSig) const {
317 if (!fValid) {
318 return false;
319 }
320 vchSig.resize(CPubKey::COMPACT_SIGNATURE_SIZE);
321 int rec = -1;
322 secp256k1_ecdsa_recoverable_signature sig;
323 int ret = secp256k1_ecdsa_sign_recoverable(
324 secp256k1_context_sign, &sig, hash.begin(), begin(),
325 secp256k1_nonce_function_rfc6979, nullptr);
326 assert(ret);
327 ret = secp256k1_ecdsa_recoverable_signature_serialize_compact(
328 secp256k1_context_sign, &vchSig[1], &rec, &sig);
329 assert(ret);
330 assert(rec != -1);
331 vchSig[0] = 27 + rec + (fCompressed ? 4 : 0);
332 return true;
333}
334
335bool CKey::Load(const CPrivKey &seckey, const CPubKey &vchPubKey,
336 bool fSkipCheck = false) {

Callers 3

BOOST_AUTO_TEST_CASEFunction · 0.80
FUZZ_TARGET_INITFunction · 0.80
MessageSignFunction · 0.80

Calls 5

beginFunction · 0.85
resizeMethod · 0.45
beginMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.64
FUZZ_TARGET_INITFunction · 0.64