@@ -8,7 +8,7 @@ use digest::{
8
8
FixedOutput , HashMarker ,
9
9
array:: {
10
10
Array ,
11
- typenum:: { IsGreaterOrEqual , IsLess , IsLessOrEqual , U2 , U256 , Unsigned } ,
11
+ typenum:: { IsGreaterOrEqual , IsLess , IsLessOrEqual , True , U2 , U256 , Unsigned } ,
12
12
} ,
13
13
core_api:: BlockSizeUser ,
14
14
} ;
@@ -28,25 +28,25 @@ use digest::{
28
28
pub struct ExpandMsgXmd < HashT , K > ( PhantomData < ( HashT , K ) > )
29
29
where
30
30
HashT : BlockSizeUser + Default + FixedOutput + HashMarker ,
31
- HashT :: OutputSize : IsLess < U256 > ,
32
- HashT :: OutputSize : IsLessOrEqual < HashT :: BlockSize > ,
31
+ HashT :: OutputSize : IsLess < U256 , Output = True > ,
32
+ HashT :: OutputSize : IsLessOrEqual < HashT :: BlockSize , Output = True > ,
33
33
K : Mul < U2 > ,
34
- HashT :: OutputSize : IsGreaterOrEqual < <K as Mul < U2 > >:: Output > ;
34
+ HashT :: OutputSize : IsGreaterOrEqual < <K as Mul < U2 > >:: Output , Output = True > ;
35
35
36
36
impl < ' a , HashT , K > ExpandMsg < ' a > for ExpandMsgXmd < HashT , K >
37
37
where
38
38
HashT : BlockSizeUser + Default + FixedOutput + HashMarker ,
39
39
// If DST is larger than 255 bytes, the length of the computed DST will depend on the output
40
40
// size of the hash, which is still not allowed to be larger than 256:
41
41
// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-13.html#section-5.4.1-6
42
- HashT :: OutputSize : IsLess < U256 > ,
42
+ HashT :: OutputSize : IsLess < U256 , Output = True > ,
43
43
// Constraint set by `expand_message_xmd`:
44
44
// https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-13.html#section-5.4.1-4
45
- HashT :: OutputSize : IsLessOrEqual < HashT :: BlockSize > ,
45
+ HashT :: OutputSize : IsLessOrEqual < HashT :: BlockSize , Output = True > ,
46
46
// The number of bits output by `HashT` MUST be larger or equal to `K * 2`:
47
47
// https://www.rfc-editor.org/rfc/rfc9380.html#section-5.3.1-2.1
48
48
K : Mul < U2 > ,
49
- HashT :: OutputSize : IsGreaterOrEqual < <K as Mul < U2 > >:: Output > ,
49
+ HashT :: OutputSize : IsGreaterOrEqual < <K as Mul < U2 > >:: Output , Output = True > ,
50
50
{
51
51
type Expander = ExpanderXmd < ' a , HashT > ;
52
52
@@ -102,8 +102,8 @@ where
102
102
pub struct ExpanderXmd < ' a , HashT >
103
103
where
104
104
HashT : BlockSizeUser + Default + FixedOutput + HashMarker ,
105
- HashT :: OutputSize : IsLess < U256 > ,
106
- HashT :: OutputSize : IsLessOrEqual < HashT :: BlockSize > ,
105
+ HashT :: OutputSize : IsLess < U256 , Output = True > ,
106
+ HashT :: OutputSize : IsLessOrEqual < HashT :: BlockSize , Output = True > ,
107
107
{
108
108
b_0 : Array < u8 , HashT :: OutputSize > ,
109
109
b_vals : Array < u8 , HashT :: OutputSize > ,
@@ -116,8 +116,8 @@ where
116
116
impl < HashT > ExpanderXmd < ' _ , HashT >
117
117
where
118
118
HashT : BlockSizeUser + Default + FixedOutput + HashMarker ,
119
- HashT :: OutputSize : IsLess < U256 > ,
120
- HashT :: OutputSize : IsLessOrEqual < HashT :: BlockSize > ,
119
+ HashT :: OutputSize : IsLess < U256 , Output = True > ,
120
+ HashT :: OutputSize : IsLessOrEqual < HashT :: BlockSize , Output = True > ,
121
121
{
122
122
fn next ( & mut self ) -> bool {
123
123
if self . index < self . ell {
@@ -146,8 +146,8 @@ where
146
146
impl < HashT > Expander for ExpanderXmd < ' _ , HashT >
147
147
where
148
148
HashT : BlockSizeUser + Default + FixedOutput + HashMarker ,
149
- HashT :: OutputSize : IsLess < U256 > ,
150
- HashT :: OutputSize : IsLessOrEqual < HashT :: BlockSize > ,
149
+ HashT :: OutputSize : IsLess < U256 , Output = True > ,
150
+ HashT :: OutputSize : IsLessOrEqual < HashT :: BlockSize , Output = True > ,
151
151
{
152
152
fn fill_bytes ( & mut self , okm : & mut [ u8 ] ) {
153
153
for b in okm {
@@ -178,7 +178,7 @@ mod test {
178
178
bytes : & [ u8 ] ,
179
179
) where
180
180
HashT : BlockSizeUser + Default + FixedOutput + HashMarker ,
181
- HashT :: OutputSize : IsLess < U256 > ,
181
+ HashT :: OutputSize : IsLess < U256 , Output = True > ,
182
182
{
183
183
let block = HashT :: BlockSize :: to_usize ( ) ;
184
184
assert_eq ! (
@@ -219,8 +219,10 @@ mod test {
219
219
) -> Result < ( ) >
220
220
where
221
221
HashT : BlockSizeUser + Default + FixedOutput + HashMarker ,
222
- HashT :: OutputSize : IsLess < U256 > + IsLessOrEqual < HashT :: BlockSize > + Mul < U8 > ,
223
- HashT :: OutputSize : IsGreaterOrEqual < <U4 as Mul < U2 > >:: Output > ,
222
+ HashT :: OutputSize : IsLess < U256 , Output = True >
223
+ + IsLessOrEqual < HashT :: BlockSize , Output = True >
224
+ + Mul < U8 > ,
225
+ HashT :: OutputSize : IsGreaterOrEqual < <U4 as Mul < U2 > >:: Output , Output = True > ,
224
226
{
225
227
assert_message :: < HashT > ( self . msg , domain, L :: to_u16 ( ) , self . msg_prime ) ;
226
228
0 commit comments