Skip to content

Commit

Permalink
Merge rust-bitcoin#4015: hashes: Derive Debug for all hash engines
Browse files Browse the repository at this point in the history
6263b9c hashes: Derive Debug for all hash engines (Tobin C. Harding)

Pull request description:

  Public types typically should implement `Debug`.

  Derive `Debug` for all the hash engines.

ACKs for top commit:
  Kixunil:
    ACK 6263b9c
  apoelstra:
    ACK 6263b9c; successfully ran local tests

Tree-SHA512: c50b7b23229c6b4bc05754142bdcc1669393dd11a7eec829f9f950d75209468693e4977582e356e2b2db6a445d22071c6e60cb6a778ab8fff705e71e680b3c8c
  • Loading branch information
apoelstra committed Feb 7, 2025
2 parents 9aaf6ae + 6263b9c commit 8464b14
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion hashes/src/hash160/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn from_engine(e: HashEngine) -> Hash {
}

/// Engine to compute HASH160 hash function.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct HashEngine(sha256::HashEngine);

impl HashEngine {
Expand Down
2 changes: 1 addition & 1 deletion hashes/src/hmac/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<T: GeneralHash + str::FromStr> str::FromStr for Hmac<T> {
}

/// Pair of underlying hash engines, used for the inner and outer hash of HMAC.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct HmacEngine<T: GeneralHash> {
iengine: T::Engine,
oengine: T::Engine,
Expand Down
2 changes: 1 addition & 1 deletion hashes/src/ripemd160/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn from_engine(e: HashEngine) -> Hash {
const BLOCK_SIZE: usize = 64;

/// Engine to compute RIPEMD160 hash function.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct HashEngine {
buffer: [u8; BLOCK_SIZE],
h: [u32; 5],
Expand Down
2 changes: 1 addition & 1 deletion hashes/src/sha1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn from_engine(mut e: HashEngine) -> Hash {
const BLOCK_SIZE: usize = 64;

/// Engine to compute SHA1 hash function.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct HashEngine {
buffer: [u8; BLOCK_SIZE],
h: [u32; 5],
Expand Down
2 changes: 1 addition & 1 deletion hashes/src/sha256/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn from_engine(e: HashEngine) -> Hash {
const BLOCK_SIZE: usize = 64;

/// Engine to compute SHA256 hash function.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct HashEngine {
buffer: [u8; BLOCK_SIZE],
h: [u32; 8],
Expand Down
2 changes: 1 addition & 1 deletion hashes/src/sha256d/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn from_engine(e: HashEngine) -> Hash {
}

/// Engine to compute SHA256d hash function.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct HashEngine(sha256::HashEngine);

impl HashEngine {
Expand Down
2 changes: 1 addition & 1 deletion hashes/src/sha384/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn from_engine(e: HashEngine) -> Hash {
}

/// Engine to compute SHA384 hash function.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct HashEngine(sha512::HashEngine);

impl HashEngine {
Expand Down
2 changes: 1 addition & 1 deletion hashes/src/sha512/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub(crate) fn from_engine(e: HashEngine) -> Hash {
pub(crate) const BLOCK_SIZE: usize = 128;

/// Engine to compute SHA512 hash function.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct HashEngine {
h: [u64; 8],
bytes_hashed: u64,
Expand Down
2 changes: 1 addition & 1 deletion hashes/src/sha512_256/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn from_engine(e: HashEngine) -> Hash {
/// the output to 256 bits. It has different initial constants than sha512 so it
/// produces an entirely different hash compared to sha512. More information at
/// <https://eprint.iacr.org/2010/548.pdf>.
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct HashEngine(sha512::HashEngine);

impl HashEngine {
Expand Down

0 comments on commit 8464b14

Please sign in to comment.