Skip to content

Commit

Permalink
blake2: add missing types of common digest sizes (#564)
Browse files Browse the repository at this point in the history
Adds the following fixed digest sizes: `BLAKE2s-128`, `BLAKE2b-128`, and `BLAKE2b-256`.
  • Loading branch information
HeCorr authored May 2, 2024
1 parent e766aec commit 470c789
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion blake2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use core::{fmt, marker::PhantomData, ops::Div};
use digest::{
array::{Array, ArraySize},
block_buffer::{Lazy, LazyBuffer},
consts::{U128, U32, U4, U64},
consts::{U128, U16, U32, U4, U64},
core_api::{
AlgorithmName, Block, BlockSizeUser, Buffer, BufferKindUser, CoreWrapper,
CtVariableCoreWrapper, OutputSizeUser, RtVariableCoreWrapper, TruncSide, UpdateCore,
Expand Down Expand Up @@ -68,6 +68,10 @@ pub type Blake2bVar = RtVariableCoreWrapper<Blake2bVarCore>;
pub type Blake2bCore<OutSize> = CtVariableCoreWrapper<Blake2bVarCore, OutSize>;
/// BLAKE2b generic over output size.
pub type Blake2b<OutSize> = CoreWrapper<Blake2bCore<OutSize>>;
/// BLAKE2b-128 hasher state.
pub type Blake2b128 = Blake2b<U16>;
/// BLAKE2b-256 hasher state.
pub type Blake2b256 = Blake2b<U32>;
/// BLAKE2b-512 hasher state.
pub type Blake2b512 = Blake2b<U64>;

Expand Down Expand Up @@ -98,6 +102,8 @@ pub type Blake2sVar = RtVariableCoreWrapper<Blake2sVarCore>;
pub type Blake2sCore<OutSize> = CtVariableCoreWrapper<Blake2sVarCore, OutSize>;
/// BLAKE2s generic over output size.
pub type Blake2s<OutSize> = CoreWrapper<Blake2sCore<OutSize>>;
/// BLAKE2s-128 hasher state.
pub type Blake2s128 = Blake2s<U16>;
/// BLAKE2s-256 hasher state.
pub type Blake2s256 = Blake2s<U32>;

Expand Down

0 comments on commit 470c789

Please sign in to comment.