File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -130,21 +130,27 @@ fn get_expected_report_data(
130130) -> JsResult < [ u8 ; 64 ] > {
131131 let mut hasher = Sha512 :: new ( ) ;
132132 hasher. update ( "noonce" ) ;
133+ hasher. update ( & ( challenge. len ( ) as u64 ) . to_be_bytes ( ) ) ;
133134 hasher. update ( challenge) ;
134135
135136 hasher. update ( "data" ) ;
137+ hasher. update ( & ( data. len ( ) as u64 ) . to_be_bytes ( ) ) ;
136138 for ( key, value) in data {
139+ hasher. update ( & ( key. len ( ) as u64 ) . to_be_bytes ( ) ) ;
137140 hasher. update ( key) ;
141+ hasher. update ( & ( value. len ( ) as u64 ) . to_be_bytes ( ) ) ;
138142 hasher. update ( value) ;
139143 }
140144
141145 if !signatures. is_empty ( ) {
142146 hasher. update ( "signatures" ) ;
147+ hasher. update ( & ( signatures. len ( ) as u64 ) . to_be_bytes ( ) ) ;
143148
144- for idx in 0 ..( ( signatures. len ( ) - 1 ) as usize ) {
149+ for idx in 0 ..= ( ( signatures. len ( ) - 1 ) as usize ) {
145150 let sig = signatures. get ( idx) ;
146151 match sig {
147152 Some ( s) => {
153+ hasher. update ( & ( s. len ( ) as u64 ) . to_be_bytes ( ) ) ;
148154 hasher. update ( s. clone ( ) ) ;
149155 }
150156 None => {
You can’t perform that action at this time.
0 commit comments