Merge bitcoin/bitcoin#36364: tools: Call SHA256AutoDetect in bitcoin-util, bitcoin-tx and bitcoin-wallet
What changed, and why it matters
This change makes three Bitcoin command-line tools (bitcoin-tx, bitcoin-util, and bitcoin-wallet) automatically pick the fastest SHA-256 hashing implementation available on the computer, such as hardware-accelerated versions on modern CPUs. Previously, only some parts of Bitcoin Core did this, so these tools used a slower generic implementation. The result is a significant speedup for operations that do a lot of hashing, but there is no security bug being fixed here.
No security action needed; treat as a routine performance improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit adds SHA256AutoDetect() calls at startup of bitcoin-tx, bitcoin-util, and bitcoin-wallet, plus the corresponding #include
Changed components
src/bitcoin-tx.cppsrc/bitcoin-util.cppsrc/bitcoin-wallet.cppInspect captured patch +6 / −0
### src/bitcoin-tx.cpp
@@ -14,6 +14,7 @@
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <core_io.h>
+#include <crypto/sha256.h>
#include <key_io.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
@@ -858,6 +859,7 @@ static int CommandLineRawTx(int argc, char* argv[])
MAIN_FUNCTION
{
SetupEnvironment();
+ SHA256AutoDetect();
try {
int ret = AppInitRawTx(argc, argv);
### src/bitcoin-util.cpp
@@ -14,6 +14,7 @@
#include <common/system.h>
#include <compat/compat.h>
#include <core_io.h>
+#include <crypto/sha256.h>
#include <streams.h>
#include <univalue.h>
#include <util/exception.h>
@@ -213,6 +214,7 @@ MAIN_FUNCTION
{
ArgsManager& args = gArgs;
SetupEnvironment();
+ SHA256AutoDetect();
try {
int ret = AppInitUtil(args, argc, argv);
### src/bitcoin-wallet.cpp
@@ -11,6 +11,7 @@
#include <common/license_info.h>
#include <common/system.h>
#include <compat/compat.h>
+#include <crypto/sha256.h>
#include <interfaces/init.h>
#include <key.h>
#include <logging.h>
@@ -103,6 +104,7 @@ MAIN_FUNCTION
}
SetupEnvironment();
+ SHA256AutoDetect();
RandomInit();
try {
if (const auto maybe_exit{WalletAppInit(args, argc, argv)}) return *maybe_exit;Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.