File tree Expand file tree Collapse file tree 2 files changed +4
-13
lines changed
Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Original file line number Diff line number Diff line change 1+ dist
2+ node_modules
13target
24export
35gates_report.json
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ pub struct Poseidon2 {
1313impl Poseidon2 {
1414 #[no_predicates]
1515 pub fn hash <let N : u32 >(input : [Field ; N ], message_size : u32 ) -> Field {
16- Poseidon2 ::hash_internal (input , message_size , message_size != N )
16+ Poseidon2 ::hash_internal (input , message_size )
1717 }
1818
1919 pub (crate ) fn new (iv : Field ) -> Poseidon2 {
@@ -59,11 +59,7 @@ impl Poseidon2 {
5959 self .state [0 ]
6060 }
6161
62- fn hash_internal <let N : u32 >(
63- input : [Field ; N ],
64- in_len : u32 ,
65- is_variable_length : bool ,
66- ) -> Field {
62+ fn hash_internal <let N : u32 >(input : [Field ; N ], in_len : u32 ) -> Field {
6763 let two_pow_64 = 18446744073709551616 ;
6864 let iv : Field = (in_len as Field ) * two_pow_64 ;
6965 let mut sponge = Poseidon2 ::new (iv );
@@ -72,13 +68,6 @@ impl Poseidon2 {
7268 sponge .absorb (input [i ]);
7369 }
7470 }
75-
76- // In the case where the hash preimage is variable-length, we append `1` to the end of the input, to distinguish
77- // from fixed-length hashes. (the combination of this additional field element + the hash IV ensures
78- // fixed-length and variable-length hashes do not collide)
79- if is_variable_length {
80- sponge .absorb (1 );
81- }
8271 sponge .squeeze ()
8372 }
8473}
You can’t perform that action at this time.
0 commit comments