Skip to content

Commit

Permalink
♻️ Use 64 byte specific keccak instruction,
Browse files Browse the repository at this point in the history
The `keccak256-aarch64-simd` crate includes a function that can accept variable-lengthed inputs, however this function has a bit of overhead due to manual padding. The input size to `keccak256` is fixed to 64 bytes here, so we can take advantage of the `simd_keccak_64b_single` function to reduce padding overhead.
  • Loading branch information
clabby committed Nov 10, 2023
1 parent 8e76f61 commit 0b5f70e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/mipsevm/src/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl CachedPage {
#[cfg(feature = "simd-keccak")]
{
let mut out = [0u8; 32];
keccak256_aarch64_simd::simd_keccak256_single::<64>(
keccak256_aarch64_simd::simd_keccak256_64b_single(
&self.data[data_idx..data_idx + 64],
&mut out,
);
Expand Down
2 changes: 1 addition & 1 deletion crates/mipsevm/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ where
#[cfg(feature = "simd-keccak")]
{
let mut out = B256::ZERO;
keccak256_aarch64_simd::simd_keccak256_single::<64>(&concat_fixed(a, b), out.as_mut());
keccak256_aarch64_simd::simd_keccak256_64b_single(&concat_fixed(a, b), out.as_mut());
out
}

Expand Down

0 comments on commit 0b5f70e

Please sign in to comment.