Module hash

Module hash 

Source
Expand description

Hardware-accelerated hashing with SIMD support

This module provides a pluggable hash algorithm system with:

  • Runtime CPU feature detection
  • SIMD-optimized implementations (AVX2 for x86_64, NEON for ARM)
  • Fallback to standard implementations
  • Modern hash algorithms (BLAKE3)

§Example

use ipfrs_core::hash::{HashEngine, Sha256Engine, Sha512Engine, Blake3Engine};

let data = b"hello world";

// SHA2-256 (32 bytes)
let sha256 = Sha256Engine::new();
let hash256 = sha256.digest(data);

// SHA2-512 (64 bytes) - stronger security
let sha512 = Sha512Engine::new();
let hash512 = sha512.digest(data);

// BLAKE3 is fastest with built-in SIMD
let blake3 = Blake3Engine::new();
let blake3_hash = blake3.digest(data);

Structs§

Blake2b256Engine
BLAKE2b-256 hash engine
Blake2b512Engine
BLAKE2b-512 hash engine
Blake2s256Engine
BLAKE2s-256 hash engine
Blake3Engine
BLAKE3 hash engine with built-in SIMD support
CpuFeatures
CPU feature detection result
HashRegistry
Hash algorithm registry for pluggable hash support
Sha3_256Engine
SHA3-256 hash engine
Sha3_512Engine
SHA3-512 hash engine
Sha256Engine
SHA2-256 hash engine with SIMD support
Sha512Engine
SHA-512 hash engine with SIMD support

Traits§

HashEngine
Trait for hardware-accelerated hash computation

Functions§

global_hash_registry
Get the global hash registry