From 470c789d9a2d2deac743e0191fe3e45dee1c6060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrique=20Corr=C3=AAa?= <75134774+HeCorr@users.noreply.github.com> Date: Thu, 2 May 2024 04:18:31 -0300 Subject: [PATCH] blake2: add missing types of common digest sizes (#564) Adds the following fixed digest sizes: `BLAKE2s-128`, `BLAKE2b-128`, and `BLAKE2b-256`. --- blake2/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/blake2/src/lib.rs b/blake2/src/lib.rs index 266c39ec..ef7d3e36 100644 --- a/blake2/src/lib.rs +++ b/blake2/src/lib.rs @@ -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, @@ -68,6 +68,10 @@ pub type Blake2bVar = RtVariableCoreWrapper; pub type Blake2bCore = CtVariableCoreWrapper; /// BLAKE2b generic over output size. pub type Blake2b = CoreWrapper>; +/// BLAKE2b-128 hasher state. +pub type Blake2b128 = Blake2b; +/// BLAKE2b-256 hasher state. +pub type Blake2b256 = Blake2b; /// BLAKE2b-512 hasher state. pub type Blake2b512 = Blake2b; @@ -98,6 +102,8 @@ pub type Blake2sVar = RtVariableCoreWrapper; pub type Blake2sCore = CtVariableCoreWrapper; /// BLAKE2s generic over output size. pub type Blake2s = CoreWrapper>; +/// BLAKE2s-128 hasher state. +pub type Blake2s128 = Blake2s; /// BLAKE2s-256 hasher state. pub type Blake2s256 = Blake2s;