11use core:: fmt;
22use digest:: {
33 CollisionResistance , ExtendableOutput , ExtendableOutputReset , HashMarker , Reset , Update ,
4- block_buffer :: BlockSizes ,
4+ array :: ArraySize ,
55 common:: { AlgorithmName , BlockSizeUser } ,
66 consts:: { U16 , U32 , U136 , U168 } ,
77} ;
@@ -10,12 +10,12 @@ use crate::{Kt, KtReader, utils::length_encode};
1010
1111/// Customized KangarooTwelve hasher generic over rate with borrrowed customization string.
1212#[ derive( Clone ) ]
13- pub struct CustomRefKt < ' a , Rate : BlockSizes > {
13+ pub struct CustomRefKt < ' a , Rate : ArraySize > {
1414 customization : & ' a [ u8 ] ,
1515 inner : Kt < Rate > ,
1616}
1717
18- impl < ' a , Rate : BlockSizes > CustomRefKt < ' a , Rate > {
18+ impl < ' a , Rate : ArraySize > CustomRefKt < ' a , Rate > {
1919 /// Create new customized KangarooTwelve hasher with borrrowed customization string.
2020 ///
2121 /// Note that this is an inherent method and `CustomRefKt` does not implement
@@ -29,56 +29,56 @@ impl<'a, Rate: BlockSizes> CustomRefKt<'a, Rate> {
2929 }
3030}
3131
32- impl < Rate : BlockSizes > Default for CustomRefKt < ' static , Rate > {
32+ impl < Rate : ArraySize > Default for CustomRefKt < ' static , Rate > {
3333 #[ inline]
3434 fn default ( ) -> Self {
3535 Self :: new_customized ( & [ ] )
3636 }
3737}
3838
39- impl < Rate : BlockSizes > fmt:: Debug for CustomRefKt < ' _ , Rate > {
39+ impl < Rate : ArraySize > fmt:: Debug for CustomRefKt < ' _ , Rate > {
4040 #[ inline]
4141 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> Result < ( ) , fmt:: Error > {
4242 write ! ( f, "CustomKt{} {{ ... }}" , 4 * ( 200 - Rate :: USIZE ) )
4343 }
4444}
4545
46- impl < Rate : BlockSizes > AlgorithmName for CustomRefKt < ' _ , Rate > {
46+ impl < Rate : ArraySize > AlgorithmName for CustomRefKt < ' _ , Rate > {
4747 #[ inline]
4848 fn write_alg_name ( f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
4949 Kt :: < Rate > :: write_alg_name ( f)
5050 }
5151}
5252
53- impl < Rate : BlockSizes > HashMarker for CustomRefKt < ' _ , Rate > { }
53+ impl < Rate : ArraySize > HashMarker for CustomRefKt < ' _ , Rate > { }
5454
55- impl < Rate : BlockSizes > BlockSizeUser for CustomRefKt < ' _ , Rate > {
55+ impl < Rate : ArraySize > BlockSizeUser for CustomRefKt < ' _ , Rate > {
5656 type BlockSize = Rate ;
5757}
5858
59- impl < Rate : BlockSizes > Update for CustomRefKt < ' _ , Rate > {
59+ impl < Rate : ArraySize > Update for CustomRefKt < ' _ , Rate > {
6060 #[ inline]
6161 fn update ( & mut self , data : & [ u8 ] ) {
6262 self . inner . update ( data) ;
6363 }
6464}
6565
66- impl < Rate : BlockSizes > Reset for CustomRefKt < ' _ , Rate > {
66+ impl < Rate : ArraySize > Reset for CustomRefKt < ' _ , Rate > {
6767 #[ inline]
6868 fn reset ( & mut self ) {
6969 self . inner . reset ( ) ;
7070 }
7171}
7272
73- impl < Rate : BlockSizes > CustomRefKt < ' _ , Rate > {
73+ impl < Rate : ArraySize > CustomRefKt < ' _ , Rate > {
7474 fn absorb_customization ( & mut self ) {
7575 self . inner . update ( self . customization ) ;
7676 let len = u64:: try_from ( self . customization . len ( ) ) . expect ( "length always fits into `u64`" ) ;
7777 length_encode ( len, |enc_len| self . inner . update ( enc_len) ) ;
7878 }
7979}
8080
81- impl < Rate : BlockSizes > ExtendableOutput for CustomRefKt < ' _ , Rate > {
81+ impl < Rate : ArraySize > ExtendableOutput for CustomRefKt < ' _ , Rate > {
8282 type Reader = KtReader < Rate > ;
8383
8484 #[ inline]
@@ -88,7 +88,7 @@ impl<Rate: BlockSizes> ExtendableOutput for CustomRefKt<'_, Rate> {
8888 }
8989}
9090
91- impl < Rate : BlockSizes > ExtendableOutputReset for CustomRefKt < ' _ , Rate > {
91+ impl < Rate : ArraySize > ExtendableOutputReset for CustomRefKt < ' _ , Rate > {
9292 #[ inline]
9393 fn finalize_xof_reset ( & mut self ) -> Self :: Reader {
9494 self . absorb_customization ( ) ;
@@ -100,7 +100,7 @@ impl<Rate: BlockSizes> ExtendableOutputReset for CustomRefKt<'_, Rate> {
100100
101101// `inner` is zeroized by `Drop` and `customization` can not be zeroized
102102#[ cfg( feature = "zeroize" ) ]
103- impl < Rate : BlockSizes > digest:: zeroize:: ZeroizeOnDrop for CustomRefKt < ' _ , Rate > { }
103+ impl < Rate : ArraySize > digest:: zeroize:: ZeroizeOnDrop for CustomRefKt < ' _ , Rate > { }
104104
105105/// Customized KT128 hasher with borrowed customization string.
106106pub type CustomRefKt128 < ' a > = CustomRefKt < ' a , U168 > ;
0 commit comments