use super::{Blake2b, Blake2s, LengthBounds};
#[allow(private_bounds)]
pub trait SupportsKeyLen<const LEN: usize>: SupportsKeyLenInternal<LEN> {}
#[allow(private_bounds)]
pub trait SupportsOutLen<const LEN: usize>: SupportsOutLenInternal<LEN> {}
pub(super) trait SupportsOutLenInternal<const LEN: usize> {}
pub(super) trait SupportsKeyLenInternal<const LEN: usize> {}
#[allow(private_bounds)]
impl<T, const LEN: usize> SupportsKeyLen<LEN> for T where T: SupportsKeyLenInternal<LEN> {}
#[allow(private_bounds)]
impl<T, const LEN: usize> SupportsOutLen<LEN> for T where T: SupportsOutLenInternal<LEN> {}
macro_rules! support_lens {
($ty:ty, $trait:ident, $($supported:expr),*) => {
$( impl $trait<$supported> for $ty {})*
};
}
#[rustfmt::skip]
support_lens!(
Blake2b<LengthBounds>, SupportsOutLenInternal,
1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56,
57, 58, 59, 60, 61, 62, 63, 64
);
#[rustfmt::skip]
support_lens!(
Blake2s<LengthBounds>, SupportsOutLenInternal,
1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32
);
#[rustfmt::skip]
support_lens!(
Blake2b<LengthBounds>, SupportsKeyLenInternal,
0,
1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56,
57, 58, 59, 60, 61, 62, 63, 64
);
#[rustfmt::skip]
support_lens!(
Blake2s<LengthBounds>, SupportsKeyLenInternal,
0,
1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32
);