From 3d1ce0d261c39a011616f8495d80ecbd0ca006e0 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 22 Aug 2024 12:07:29 +1000 Subject: [PATCH] Truncate secret hash using precision Currently we are attempting to truncate the hash created using `bitcoin_hashes` by using the "width" formatting parameter instead of the "precision" parameter. `hex-conservative` truncates with the "precision" parameter as is expected since a hash is not an integral type. Use the formatting string `"{:.16}"` which is the "precision" formatting parameter. --- src/secret.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/secret.rs b/src/secret.rs index f13d91ae9..49323dd27 100644 --- a/src/secret.rs +++ b/src/secret.rs @@ -46,7 +46,7 @@ macro_rules! impl_display_secret { engine.input(&self.secret_bytes()); let hash = sha256::Hash::from_engine(engine); - f.debug_tuple(stringify!($thing)).field(&format_args!("#{:016x}", hash)).finish() + f.debug_tuple(stringify!($thing)).field(&format_args!("#{:.16}", hash)).finish() } }