Skip to content

Commit

Permalink
6A
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-shandar committed Jul 18, 2024
1 parent 64325a2 commit 224d573
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions blockset-lib/src/sha2/hash_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ mod tests {
#[test]
#[wasm_bindgen_test]
fn test() {
let f = |init, k, len| {
let state = HashState::new(init);
state.end(k, len)
};
let f = |init, k, len| HashState::new(init).end(k, len);
// d14a028c_2a3a2bc9_476102bb_288234c4
// 15a2b01f_828ea62a_c5b3e42f
{
Expand Down Expand Up @@ -338,5 +335,27 @@ mod tests {
0xa32254a_85e25153b_03f9cd3e_c2cfd74a
])
);
// "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEFabcdefghi"
// d4f8ba39f2bbf210e284c3df1af0f4a842d56f8d59a13f9ccbc762d97487ff0a
assert_eq!(
f(
SHA256,
[
[
0x43444546_38394142_34353637_30313233,
0x43444546_38394142_34353637_30313233
],
[
0x43444546_38394142_34353637_30313233,
0x69000000_65666768_61626364
]
],
456
),
u256x::swap32([
0x42d56f8_d59a13f9c_cbc762d9_7487ff0a,
0xd4f8ba3_9f2bbf210_e284c3df_1af0f4a8
])
);
}
}

0 comments on commit 224d573

Please sign in to comment.