Finger & AIly
AIly AIly
Hey, I was looking at the latest studies on key‑stretching algorithms—have you compared Argon2 against scrypt in terms of memory‑hardness and latency? I’m curious how you’d optimize a password vault for both speed and resistance to side‑channel attacks.
Finger Finger
Argon2id is usually the better choice if you need a tight balance between memory‑hardness and latency. It lets you set a precise memory size, a time cost, and a degree of parallelism, all in one call, and the algorithm is designed to avoid cache‑timing leaks. Scrypt also forces a lot of memory but it has a fixed “salted” structure that makes it a bit harder to tweak the latency independently of the memory. For a password vault, I’d pick Argon2id, set the memory to at least 512 MiB on a laptop, a time cost of 3–5 rounds, and a parallelism of 2 or 4, depending on the CPU. Then wrap the hash in a constant‑time compare, zero out buffers immediately, and keep all key‑derivation code in a sandboxed kernel module if you’re worried about side‑channels. That gives you good speed on modern hardware while keeping the attack surface low.
AIly AIly
Sounds solid—Argon2id with 512 MiB and a few rounds is a good baseline. I’ll run a quick benchmark on my dev box, then schedule a 10‑minute block tomorrow to tweak the parallelism. Also, I’ll draft a zero‑buffer cleanup routine; the more deterministic that is, the less wiggle room an attacker has. Let me know if you want the exact param table or if you’re testing a different CPU tier.
Finger Finger
Sounds good—10 minutes is tight enough to keep the focus, but enough to catch edge cases. Send the param table when you’re ready, and I’ll cross‑check the memory and time curves against the target CPU tier. Make sure the cleanup routine stays in constant time; I’ll verify the logic once I see it.
AIly AIly
Sure thing—here’s the quick table: - Memory: 512 MiB - Time cost: 4 rounds - Parallelism: 2 - Salt size: 16 bytes - Output length: 32 bytes All of the cleanup routines are in a single, linear loop that zeroes out the buffer and never branches on any value. I’ll attach the source when I send the table. Let me know if the constants need tweaking for your CPU tier.
Finger Finger
Looks solid; 512 MiB is plenty, 4 rounds give you the 10–15 ms target on a mid‑tier CPU, and a parallelism of 2 keeps the GPU burst attack in check. Just double‑check that the clock‑source you’re using for the timer isn’t exposed to timing leakage; a constant‑time compare on the derived key will do the rest. If you’re on a newer 4‑core node, you could bump parallelism to 4 for a slight speed‑up, but keep the memory the same to stay in the same threat envelope. Otherwise, send over the source and I’ll run a quick check.