Skip to content

Commit

Permalink
fix: add chunk length assertions in hash_chunks_sha256
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Bostoen committed Sep 6, 2024
1 parent 6163758 commit 2f5fbd5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ssz-rs/src/merkleization/hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ pub fn hash_chunks_sha256(
left: impl AsRef<[u8]>,
right: impl AsRef<[u8]>,
) -> [u8; BYTES_PER_CHUNK] {
debug_assert!(left.as_ref().len() == BYTES_PER_CHUNK);
debug_assert!(right.as_ref().len() == BYTES_PER_CHUNK);

let mut hasher = Sha256::new();
hasher.update(left.as_ref());
hasher.update(right.as_ref());
Expand Down

0 comments on commit 2f5fbd5

Please sign in to comment.