Skip to content

Commit

Permalink
temporary: using sha256 from bitcoin core for equivalency
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruv committed Apr 9, 2022
1 parent d0aef7a commit ffd6eb3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ void CNode::CopyStats(CNodeStats& stats)
void CNode::InitV2P2P(const CPubKey& peer_pubkey, const Span<uint8_t> initiator_hdata, const Span<uint8_t> responder_hdata, bool initiating)
{
ECDHSecret ecdh_secret;
v2_priv_key.ComputeECDHSecret(peer_pubkey, ecdh_secret);
v2_priv_key.ComputeBIP324ECDHSecret(peer_pubkey, ecdh_secret);

BIP324Keys v2_keys;
DeriveBIP324Keys(std::move(ecdh_secret), initiator_hdata, responder_hdata, v2_keys);
Expand Down
4 changes: 2 additions & 2 deletions src/test/net_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1140,9 +1140,9 @@ void bip324_assert_test_vector(const P2PV2TestVector& tv) {

ECDHSecret initiator_ecdh_secret, responder_ecdh_secret;
CPubKey resp_pubkey{responder_ellsq};
tv.initiator.key.ComputeECDHSecret(resp_pubkey, initiator_ecdh_secret);
tv.initiator.key.ComputeBIP324ECDHSecret(resp_pubkey, initiator_ecdh_secret);
CPubKey init_pubkey{initiator_ellsq};
tv.responder.key.ComputeECDHSecret(init_pubkey, responder_ecdh_secret);
tv.responder.key.ComputeBIP324ECDHSecret(init_pubkey, responder_ecdh_secret);
BOOST_CHECK_EQUAL(memcmp(initiator_ecdh_secret.data(), responder_ecdh_secret.data(), ECDH_SECRET_SIZE), 0);
BOOST_CHECK_EQUAL(memcmp(initiator_ecdh_secret.data(), tv.expected_ecdh_secret.data(), ECDH_SECRET_SIZE), 0);
BOOST_CHECK_EQUAL(memcmp(responder_ecdh_secret.data(), tv.expected_ecdh_secret.data(), ECDH_SECRET_SIZE), 0);
Expand Down

0 comments on commit ffd6eb3

Please sign in to comment.