diff --git a/tiger/src/lib.rs b/tiger/src/lib.rs index da7e3def..cacc6c29 100644 --- a/tiger/src/lib.rs +++ b/tiger/src/lib.rs @@ -37,7 +37,7 @@ const S0: State = [ /// Core Tiger hasher state. #[derive(Clone)] -pub struct TigerCore { +pub struct TigerCore { block_len: u64, state: State, } @@ -47,21 +47,21 @@ pub type Tiger = CoreWrapper>; /// Tiger2 hasher state. pub type Tiger2 = CoreWrapper>; -impl HashMarker for TigerCore {} +impl HashMarker for TigerCore {} -impl BlockSizeUser for TigerCore { +impl BlockSizeUser for TigerCore { type BlockSize = U64; } -impl BufferKindUser for TigerCore { +impl BufferKindUser for TigerCore { type BufferKind = Eager; } -impl OutputSizeUser for TigerCore { +impl OutputSizeUser for TigerCore { type OutputSize = U24; } -impl UpdateCore for TigerCore { +impl UpdateCore for TigerCore { #[inline] fn update_blocks(&mut self, blocks: &[Block]) { self.block_len += blocks.len() as u64; @@ -71,14 +71,14 @@ impl UpdateCore for TigerCore { } } -impl FixedOutputCore for TigerCore { +impl FixedOutputCore for TigerCore { #[inline] fn finalize_fixed_core(&mut self, buffer: &mut Buffer, out: &mut Output) { let bs = Self::BlockSize::U64; let pos = buffer.get_pos() as u64; let bit_len = 8 * (pos + bs * self.block_len); - if IS_VER2 { + if VER2 { buffer.len64_padding_le(bit_len, |b| compress(&mut self.state, b.as_ref())); } else { buffer.digest_pad(1, &bit_len.to_le_bytes(), |b| { @@ -92,7 +92,7 @@ impl FixedOutputCore for TigerCore { } } -impl Default for TigerCore { +impl Default for TigerCore { #[inline] fn default() -> Self { Self { @@ -102,17 +102,17 @@ impl Default for TigerCore { } } -impl Reset for TigerCore { +impl Reset for TigerCore { #[inline] fn reset(&mut self) { *self = Default::default(); } } -impl AlgorithmName for TigerCore { +impl AlgorithmName for TigerCore { #[inline] fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result { - if IS_VER2 { + if VER2 { f.write_str("Tiger2") } else { f.write_str("Tiger") @@ -120,9 +120,9 @@ impl AlgorithmName for TigerCore { } } -impl fmt::Debug for TigerCore { +impl fmt::Debug for TigerCore { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if IS_VER2 { + if VER2 { f.write_str("Tiger2Core { ... }") } else { f.write_str("TigerCore { ... }") @@ -130,7 +130,7 @@ impl fmt::Debug for TigerCore { } } -impl Drop for TigerCore { +impl Drop for TigerCore { #[inline] fn drop(&mut self) { #[cfg(feature = "zeroize")] @@ -142,4 +142,4 @@ impl Drop for TigerCore { } #[cfg(feature = "zeroize")] -impl ZeroizeOnDrop for TigerCore {} +impl ZeroizeOnDrop for TigerCore {}