MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / SignCompact

Method SignCompact

src/key.cpp:198–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198bool CKey::SignCompact(const uint256 &hash, std::vector<unsigned char>& vchSig) const {
199 if (!fValid)
200 return false;
201 vchSig.resize(65);
202 int rec = -1;
203 secp256k1_ecdsa_recoverable_signature sig;
204 int ret = secp256k1_ecdsa_sign_recoverable(secp256k1_context_sign, &sig, hash.begin(), begin(), secp256k1_nonce_function_rfc6979, NULL);
205 assert(ret);
206 secp256k1_ecdsa_recoverable_signature_serialize_compact(secp256k1_context_sign, (unsigned char*)&vchSig[1], &rec, &sig);
207 assert(ret);
208 assert(rec != -1);
209 vchSig[0] = 27 + rec + (fCompressed ? 4 : 0);
210 return true;
211}
212
213bool CKey::Load(CPrivKey &privkey, CPubKey &vchPubKey, bool fSkipCheck=false) {
214 if (!ec_privkey_import_der(secp256k1_context_sign, (unsigned char*)begin(), &privkey[0], privkey.size()))

Callers 3

signmessageFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 4

resizeMethod · 0.80
beginMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64