#[repr(u8)]pub enum Blake2bBackend {
Scalar = 0,
Sse41 = 1,
Avx2 = 2,
Avx512 = 3,
}Expand description
The compression implementations available to BLAKE2b on this target.
This is deliberately separate from crate::fill_block::Backend. One
BLAKE2b compression has four naturally parallel G functions. SSE4.1
handles them as two pairs; AVX2 handles all four in one register. The
AVX-512 backend requires AVX2, AVX-512F and AVX-512VL, and uses a native
256-bit rotate instead of widening into half-empty ZMM registers.
A two-register NEON version was also measured on Apple ARM64 and rejected: it made the 72-byte digest 16% slower and the 1 KiB expansion 26% slower than scalar. On x86, upstream’s SSE4.1 schedule was retained because it made Argon2’s 72-to-1024-byte expansion 15-16% faster on AMD EPYC. SSE2 and SSSE3 were rejected because they regressed longer inputs substantially.
Variants§
Scalar = 0
Portable scalar code. Always available.
Sse41 = 1
x86/x86-64 SSE4.1, two 64-bit lanes per register.
Avx2 = 2
x86/x86-64 AVX2, four 64-bit lanes.
Avx512 = 3
x86/x86-64 AVX2 + AVX-512F + AVX-512VL, with native rotates.
Implementations§
Source§impl Blake2bBackend
impl Blake2bBackend
Sourcepub const ALL: &'static [Blake2bBackend]
pub const ALL: &'static [Blake2bBackend]
Every BLAKE2b backend compiled for this target.
Sourcepub fn is_available(self) -> bool
pub fn is_available(self) -> bool
Whether this CPU can execute the backend right now.
Trait Implementations§
Source§impl Clone for Blake2bBackend
impl Clone for Blake2bBackend
Source§fn clone(&self) -> Blake2bBackend
fn clone(&self) -> Blake2bBackend
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more