Merge rust-bitcoin/rust-bitcoin#4015: hashes: Derive `Debug` for all hash engines
6263b9c6af
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: ACK6263b9c6af
apoelstra: ACK 6263b9c6afc377822d0cefb1303e98ea51f1a5b6; successfully ran local tests Tree-SHA512: c50b7b23229c6b4bc05754142bdcc1669393dd11a7eec829f9f950d75209468693e4977582e356e2b2db6a445d22071c6e60cb6a778ab8fff705e71e680b3c8c
This commit is contained in:
commit
8464b1452f
|
@ -25,7 +25,7 @@ fn from_engine(e: HashEngine) -> Hash {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Engine to compute HASH160 hash function.
|
/// Engine to compute HASH160 hash function.
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HashEngine(sha256::HashEngine);
|
pub struct HashEngine(sha256::HashEngine);
|
||||||
|
|
||||||
impl HashEngine {
|
impl HashEngine {
|
||||||
|
|
|
@ -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.
|
/// Pair of underlying hash engines, used for the inner and outer hash of HMAC.
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HmacEngine<T: GeneralHash> {
|
pub struct HmacEngine<T: GeneralHash> {
|
||||||
iengine: T::Engine,
|
iengine: T::Engine,
|
||||||
oengine: T::Engine,
|
oengine: T::Engine,
|
||||||
|
|
|
@ -48,7 +48,7 @@ fn from_engine(e: HashEngine) -> Hash {
|
||||||
const BLOCK_SIZE: usize = 64;
|
const BLOCK_SIZE: usize = 64;
|
||||||
|
|
||||||
/// Engine to compute RIPEMD160 hash function.
|
/// Engine to compute RIPEMD160 hash function.
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HashEngine {
|
pub struct HashEngine {
|
||||||
buffer: [u8; BLOCK_SIZE],
|
buffer: [u8; BLOCK_SIZE],
|
||||||
h: [u32; 5],
|
h: [u32; 5],
|
||||||
|
|
|
@ -40,7 +40,7 @@ fn from_engine(mut e: HashEngine) -> Hash {
|
||||||
const BLOCK_SIZE: usize = 64;
|
const BLOCK_SIZE: usize = 64;
|
||||||
|
|
||||||
/// Engine to compute SHA1 hash function.
|
/// Engine to compute SHA1 hash function.
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HashEngine {
|
pub struct HashEngine {
|
||||||
buffer: [u8; BLOCK_SIZE],
|
buffer: [u8; BLOCK_SIZE],
|
||||||
h: [u32; 5],
|
h: [u32; 5],
|
||||||
|
|
|
@ -54,7 +54,7 @@ fn from_engine(e: HashEngine) -> Hash {
|
||||||
const BLOCK_SIZE: usize = 64;
|
const BLOCK_SIZE: usize = 64;
|
||||||
|
|
||||||
/// Engine to compute SHA256 hash function.
|
/// Engine to compute SHA256 hash function.
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HashEngine {
|
pub struct HashEngine {
|
||||||
buffer: [u8; BLOCK_SIZE],
|
buffer: [u8; BLOCK_SIZE],
|
||||||
h: [u32; 8],
|
h: [u32; 8],
|
||||||
|
|
|
@ -20,7 +20,7 @@ fn from_engine(e: HashEngine) -> Hash {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Engine to compute SHA256d hash function.
|
/// Engine to compute SHA256d hash function.
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HashEngine(sha256::HashEngine);
|
pub struct HashEngine(sha256::HashEngine);
|
||||||
|
|
||||||
impl HashEngine {
|
impl HashEngine {
|
||||||
|
|
|
@ -17,7 +17,7 @@ fn from_engine(e: HashEngine) -> Hash {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Engine to compute SHA384 hash function.
|
/// Engine to compute SHA384 hash function.
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HashEngine(sha512::HashEngine);
|
pub struct HashEngine(sha512::HashEngine);
|
||||||
|
|
||||||
impl HashEngine {
|
impl HashEngine {
|
||||||
|
|
|
@ -49,7 +49,7 @@ pub(crate) fn from_engine(e: HashEngine) -> Hash {
|
||||||
pub(crate) const BLOCK_SIZE: usize = 128;
|
pub(crate) const BLOCK_SIZE: usize = 128;
|
||||||
|
|
||||||
/// Engine to compute SHA512 hash function.
|
/// Engine to compute SHA512 hash function.
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HashEngine {
|
pub struct HashEngine {
|
||||||
h: [u64; 8],
|
h: [u64; 8],
|
||||||
bytes_hashed: u64,
|
bytes_hashed: u64,
|
||||||
|
|
|
@ -27,7 +27,7 @@ fn from_engine(e: HashEngine) -> Hash {
|
||||||
/// the output to 256 bits. It has different initial constants than sha512 so it
|
/// 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
|
/// produces an entirely different hash compared to sha512. More information at
|
||||||
/// <https://eprint.iacr.org/2010/548.pdf>.
|
/// <https://eprint.iacr.org/2010/548.pdf>.
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HashEngine(sha512::HashEngine);
|
pub struct HashEngine(sha512::HashEngine);
|
||||||
|
|
||||||
impl HashEngine {
|
impl HashEngine {
|
||||||
|
|
Loading…
Reference in New Issue