Skip to main content

batch_sha256

Function batch_sha256 

Source
pub fn batch_sha256(inputs: &[&[u8]]) -> Vec<[u8; 32]>
Expand description

Batch SHA256: Compute SHA256 for multiple independent inputs

§Arguments

  • inputs - Slice of byte slices to hash

§Returns

Vector of 32-byte hashes, one per input (in same order)

§Performance

  • Small batches (< 4 items): Sequential (overhead not worth parallelization)
  • Medium batches (4-7 items): Chunked sequential
  • Large batches (≥8 items): Multi-core parallelization with Rayon

§Optimizations

  • Uses sha2 crate with “asm” feature for optimized assembly
  • For large batches, leverages Rayon for multi-core parallelization
  • AVX2 batch optimization available via crypto::avx2_batch module