Skip to main content

Crate lib_q_keccak

Crate lib_q_keccak 

Source
Expand description

Pure Rust implementation of the Keccak sponge function.

This crate provides low-level Keccak permutation functions (keccak-f and keccak-p variants). For high-level SHA-3 hash functions, see lib-q-sha3.

§Features

  • no_std compatible: Works in embedded and WASM environments
  • Optimized implementations: Platform-specific optimizations for ARM64 and x86_64
  • SIMD support: Parallel processing with portable SIMD
  • Multi-threading: Concurrent state processing for high-performance applications
  • WebAssembly: Full WASM support with JavaScript interop

§Example

// Test vectors are from KeccakCodePackage
let mut data = [0u64; 25];

lib_q_keccak::f1600(&mut data);

§Configuration

To disable loop unrolling (e.g. for constraint targets) use the no_unroll feature.

Modules§

advanced
Advanced SIMD optimizations using nightly features
detection
Runtime feature detection utilities
parallel
Parallel processing interface for batch operations
simd
SIMD implementations for Keccak-f1600 sponge function
simd_parallel
Parallel Keccak-p[1600] processing functions

Macros§

unroll5
unroll5
unroll24
unroll24

Structs§

CryptoThreadPool
Thread-safe cryptographic thread pool
FeatureConfig
Runtime feature detection and configuration
FeatureReport
Comprehensive feature availability report
SimdConfig
SIMD processing configuration for security and performance tuning
SimdSecurityValidator
SIMD state validation and security checks
ThreadingConfig
Thread-safe configuration for multi-threading operations
WorkerStats
Worker statistics for monitoring and debugging

Enums§

AffinityStrategy
Thread affinity strategy for optimizing cache performance
OptimizationLevel
Platform-specific optimization selector

Traits§

AdvancedLaneSize
Advanced SIMD lane size trait for secure parallel processing
LaneSize
Keccak is a permutation over an array of lanes which comprise the sponge construction.

Functions§

f200
Keccak-f sponge function
f400
Keccak-f sponge function
f800
Keccak-f sponge function
f1600
Keccak-f sponge function
fast_loop_absorb_optimized
Fast loop absorption with automatic optimization selection
get_global_config
Get the global feature configuration.
get_global_thread_pool
Get the global thread pool instance
init_global_thread_pool
Initialize the global thread pool (first call wins; later configs are ignored).
keccak_p
Generic Keccak-p sponge function
p200
Keccak-p sponge function
p400
Keccak-p sponge function
p800
Keccak-p sponge function
p1600
Keccak-p sponge function
p1600_multithreaded
Multi-threaded parallel processing for large workloads
p1600_optimized
Optimized Keccak-p[1600] permutation with automatic optimization selection
p1600x4
Apply Keccak-p[1600, round_count] to four independent states at once.
p1600x8
Apply Keccak-p[1600, round_count] to eight independent states at once.
process_keccak_states_global
Process Keccak states using the global thread pool
reset_global_config
Reset the global feature configuration to its unset state.
set_global_config
Set the global feature configuration.