MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ComputeBIP324ECDHSecret

Method ComputeBIP324ECDHSecret

src/key.cpp:327–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327ECDHSecret CKey::ComputeBIP324ECDHSecret(const EllSwiftPubKey& their_ellswift, const EllSwiftPubKey& our_ellswift, bool initiating) const
328{
329 assert(keydata);
330
331 ECDHSecret output;
332 // BIP324 uses the initiator as party A, and the responder as party B. Remap the inputs
333 // accordingly:
334 bool success = secp256k1_ellswift_xdh(secp256k1_context_static,
335 UCharCast(output.data()),
336 UCharCast(initiating ? our_ellswift.data() : their_ellswift.data()),
337 UCharCast(initiating ? their_ellswift.data() : our_ellswift.data()),
338 keydata->data(),
339 initiating ? 0 : 1,
340 secp256k1_ellswift_xdh_hash_function_bip324,
341 nullptr);
342 // Should always succeed for valid keys (assert above).
343 assert(success);
344 return output;
345}
346
347KeyPair CKey::ComputeKeyPair(const uint256* merkle_root) const
348{

Callers 3

InitializeMethod · 0.80
key.cppFile · 0.80
BIP324_ECDHFunction · 0.80

Calls 3

secp256k1_ellswift_xdhFunction · 0.85
UCharCastFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected