mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 11:13:23 -03:00
Merge bitcoin/bitcoin#29820: refactor, bench, fuzz: Drop unneeded UCharCast
calls
56e1e5dd10
refactor, bench, fuzz: Drop unneeded `UCharCast` calls (Hennadii Stepanov) Pull request description: The `CKey::Set()` template function handles `std::byte` just fine:b5d21182e5/src/key.h (L105)
Noticed in https://github.com/bitcoin/bitcoin/pull/29774#discussion_r1546288181. ACKs for top commit: maflcko: lgtm ACK56e1e5dd10
laanwj: Seems fine, code review ACK56e1e5dd10
hernanmarino: ACK56e1e5dd10
Tree-SHA512: 0f6b6e66692e70e083c7768aa4859c7db11aa034f555d19df0e5d33b18c0367ba1c886bcb6be3fdea78248a3cf8285576120812da55b995ef5e6c94a9dbd9f7c
This commit is contained in:
commit
e31956980e
3 changed files with 3 additions and 3 deletions
|
@ -27,7 +27,7 @@ static void BIP324_ECDH(benchmark::Bench& bench)
|
||||||
|
|
||||||
bench.batch(1).unit("ecdh").run([&] {
|
bench.batch(1).unit("ecdh").run([&] {
|
||||||
CKey key;
|
CKey key;
|
||||||
key.Set(UCharCast(key_data.data()), UCharCast(key_data.data()) + 32, true);
|
key.Set(key_data.data(), key_data.data() + 32, true);
|
||||||
EllSwiftPubKey our_ellswift(our_ellswift_data);
|
EllSwiftPubKey our_ellswift(our_ellswift_data);
|
||||||
EllSwiftPubKey their_ellswift(their_ellswift_data);
|
EllSwiftPubKey their_ellswift(their_ellswift_data);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ static void EllSwiftCreate(benchmark::Bench& bench)
|
||||||
bench.batch(1).unit("pubkey").run([&] {
|
bench.batch(1).unit("pubkey").run([&] {
|
||||||
auto ret = key.EllSwiftCreate(MakeByteSpan(entropy));
|
auto ret = key.EllSwiftCreate(MakeByteSpan(entropy));
|
||||||
/* Use the first 32 bytes of the ellswift encoded public key as next private key. */
|
/* Use the first 32 bytes of the ellswift encoded public key as next private key. */
|
||||||
key.Set(UCharCast(ret.data()), UCharCast(ret.data()) + 32, true);
|
key.Set(ret.data(), ret.data() + 32, true);
|
||||||
assert(key.IsValid());
|
assert(key.IsValid());
|
||||||
/* Use the last 32 bytes of the ellswift encoded public key as next entropy. */
|
/* Use the last 32 bytes of the ellswift encoded public key as next entropy. */
|
||||||
std::copy(ret.begin() + 32, ret.begin() + 64, MakeWritableByteSpan(entropy).begin());
|
std::copy(ret.begin() + 32, ret.begin() + 64, MakeWritableByteSpan(entropy).begin());
|
||||||
|
|
|
@ -15,7 +15,7 @@ void MockedDescriptorConverter::Init() {
|
||||||
// an extended one.
|
// an extended one.
|
||||||
if (IdIsCompPubKey(i) || IdIsUnCompPubKey(i) || IdIsXOnlyPubKey(i) || IdIsConstPrivKey(i)) {
|
if (IdIsCompPubKey(i) || IdIsUnCompPubKey(i) || IdIsXOnlyPubKey(i) || IdIsConstPrivKey(i)) {
|
||||||
CKey privkey;
|
CKey privkey;
|
||||||
privkey.Set(UCharCast(key_data.begin()), UCharCast(key_data.end()), !IdIsUnCompPubKey(i));
|
privkey.Set(key_data.begin(), key_data.end(), !IdIsUnCompPubKey(i));
|
||||||
if (IdIsCompPubKey(i) || IdIsUnCompPubKey(i)) {
|
if (IdIsCompPubKey(i) || IdIsUnCompPubKey(i)) {
|
||||||
CPubKey pubkey{privkey.GetPubKey()};
|
CPubKey pubkey{privkey.GetPubKey()};
|
||||||
keys_str[i] = HexStr(pubkey);
|
keys_str[i] = HexStr(pubkey);
|
||||||
|
|
Loading…
Add table
Reference in a new issue