You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
argon2: better SIMD optimizations translated from reference implementation #104
👋 Hey there, would it be possible to assign this issue to me? I'd like to implement it as part of a work project and have some allocated time.
We're expecting that this should provide a fairly significant speedup to x86 users who have system made in the last 10 years. My preliminary benchmarking against the C library shows that there's a 40% improvement in speed with 64MiB, and matches the memory size in "helpfulness" as it goes down.
I don't plan to port the AVX512 implementation right away since I don't have a way to test it and, IMO, its of limited usefulness in the correct scenario where passwords are hashed on the client since most consumer CPUs don't support it anyway.
Reacted by Cooper Walbrun, Tony Arcieri, Mikhail Krassavin and Bug-Reaper
#440 is a nice stopgap using auto-vectorization, but opt.c contains a natively AVX2/AVX512-optimized implementation it would be nice to eventually port over
As an update on #408, the current argon2 AVX2 implementation is now only 2-3x slower than the Go Implementation even for high Parallelism costs, and (as expected) beats the Go implementation when Parallelism = 1. Tested on an AMD Ryzen 7 5700G, best of 3 runs.
changed the title [-]argon2: optimized implementation[/-][+]argon2: better SIMD optimizations translated from reference implementation[/+]on Mar 28, 2026
Activity
Merge pull request RustCrypto#104 from RustCrypto/github-actions/no_std
complexspaces commentedon Mar 29, 2023
👋 Hey there, would it be possible to assign this issue to me? I'd like to implement it as part of a work project and have some allocated time.
We're expecting that this should provide a fairly significant speedup to x86 users who have system made in the last 10 years. My preliminary benchmarking against the C library shows that there's a 40% improvement in speed with 64MiB, and matches the memory size in "helpfulness" as it goes down.
I don't plan to port the AVX512 implementation right away since I don't have a way to test it and, IMO, its of limited usefulness in the correct scenario where passwords are hashed on the client since most consumer CPUs don't support it anyway.
tarcieri commentedon Mar 29, 2023
@complexspaces sounds great! Even the AVX2 implementation would be fantastic.
FWIW we use the
cpufeaturescrate elsewhere to autodetect AVX2 and use it when available.Palladinium commentedon Dec 26, 2023
Given that #440 has been merged, is this still an issue? If so, what needs to be done to address it?
tarcieri commentedon Dec 26, 2023
#440 is a nice stopgap using auto-vectorization, but
opt.ccontains a natively AVX2/AVX512-optimized implementation it would be nice to eventually port overjosephlr commentedon Apr 11, 2024
As an update on #408, the current argon2 AVX2 implementation is now only 2-3x slower than the Go Implementation even for high
Parallelismcosts, and (as expected) beats the Go implementation whenParallelism = 1. Tested on an AMD Ryzen 7 5700G, best of 3 runs.With
Memory = 128 MiB,Time = 64With
Memory = 64 MiB,Time = 32Rust Implementation
Profile
Run
Go Implementation
Built with
C Implementation
Built against the upstream library with
-march=native.[-]argon2: optimized implementation[/-][+]argon2: better SIMD optimizations translated from reference implementation[/+]therecluse26 commentedon Oct 9, 2026
I've opened #937, which ports the AVX2 code paths from
opt.candblamka-round-opt.h.It picks the backend at runtime with
cpufeatures, once per hash, and leaves the portable path alone. Output, public API and MSRV don't change.Single-threaded Argon2id,
p=1, hashes/sec (median of 5 runs),master→ PR:m=19456 t=2m=7168 t=5That beats the C reference's AVX2 build on both machines. I left AVX-512 out for now, but I'm happy to add it in a follow-up if there's interest.
@complexspaces I saw you picked this up back in 2023. If you've got something in progress, I'm happy to work together on it.