splitting off from #ideas > builtin cryptography
here's an idea of some initial cryptographic functions we could support:
obviously we can expand the list over time, but these three seem fairly uncontroversial as inclusions
sha256 being used in a number of applications, and blake3 being faster than sha256 if you don't need compatibility with some other project
Argon2 is the algorithm where it is really easy to dos yourself, right? Cause it has a heavy memory footprint. Though I know that definitely depends on the exact sub variant and what not.
hm, could be! Although I guess any "specify how many iterations you want" algorithm could have that property
Looks like Stytch (an idp) uses scrypt over Argon2 because Argon2 is too time intensive for their use case https://stytch.com/blog/argon2-vs-bcrypt-vs-scrypt/#:~:text=For%20password%20protection%2C%20Argon2%2C%20bcrypt,increase%20computational%20strength%20against%20attacks.
To clarify, all of the parameters are tunable with argon2. That is one of its blessings (and also huge curse). My knowledge could be outdated, but if I recall correctly, recommended settings have quite high memory to make it hard to attack passwords with a GPU. The GPU will be out of memory long before it is able to saturate the compute units.
Ah yeah. If you look at the recommended settings here: https://en.wikipedia.org/wiki/Argon2#Recommended_minimum_parameters
Minimum memory usage and max compute still uses 7MiB per password being hashed. This may sound relatively small, but it easily explodes. Only takes a ~4.5 thousand password requests (trivial to generate from a single server) to use a full 32GiB of ram.
This is where having bcrypt, for example, as an alternative is nice. It only takes 4KiB of ram.
Oh, and it seems that the recommendation on memory use may have actually gone up based on the owasp website. Now 19 MiB. Nevermind, main recommendation is 19MiB, but they still support a 7MiB configuration.
Anyway, argon2 is probably still reasonable, but it is honestly not what I would recommend for any sort of hobbiest or small business type site. Instead I would recommend something less secure but also less resource intense to avoid crazy bills/overloaded servers/overly complex infra.
But I also am by no means even in the slightest an expert on this. Just something I find interesting and have dug into in the past.
Aside, will our builtin help users pick correct defaults with salts and peppers?
I hope so!
Brendan Hansknecht said:
Anyway, argon2 is probably still reasonable, but it is honestly not what I would recommend for any sort of hobbiest or small business type site. Instead I would recommend something less secure but also less resource intense to avoid crazy bills/overloaded servers/overly complex infra.
From my understanding of the cryptography course I'm following. If you allow human chosen passwords, the entropy is too limited to be secure. So the only defense mechanism possible against attacks is to make it expensive for an attacker. So many iterations of the hashing algorithm and lot of memory to prevent attacks with GPU and other ASICs
It might also be interesting to steer hobbiest towards no-password solutions.
To be clear, I mention hobbiest/small businesses specifically cause often they have <= 1 tech person who may not really know security. As such, they are exceptionally unlikely to think of the cpu/memory/security trade off at all (also unlikely to know what a salt or pepper is or what he different algorithms really are). They still might be attacked by a bad actor or bot, but they are unlikely to be a target of a meaningful break due to the scope of their work.
In the modern day, memory actually tends to cost more than compute. That said, many services bill per time of usage. So it isn't a clear picture.
Fundamentally, a password auth api is one of the easiest targets for ddos. It also is pretty trivial to to protect from a small ddos. The simplest being a per ip rate limit. That leads to a fast path where the attacker mostly gets regular errors that are fast to execute and rarely gets to actually cause password hashing to occur. This brings the site from trivial to ddos to stardard difficulty to ddos.
Side note, I say ddos, but with a password auth target, a single machine might be able to incur a large bill for a hobbiest or small business.
It might also be interesting to steer hobbiest towards no-password solutions.
Very true
Just thinking out loud.
In addition to rate limiting, what do you think of forcing the client to compute the hash, in a two-step process.
Step 1: client send username, server respond with associated salt if exists or set a new one if not (temporarily).
Step 2: given salt, the client must compute the hash and send it to the server, that just have to check if correct.
With this, the server cost is very minimal, and the one making the attack pays the compute price.
I don't think that works
Cause then you haven't verified if the client knows the password
You might have had a data breach and the hacker sent you the hash for an account without knowing the password.
Not sure what you mean? The hash of the password is in the database, so you just check if the hash they sent is correct?
Oh you mean for creation of passwords?
Brendan Hansknecht said:
You might have had a data breach and the hacker sent you the hash for an account without knowing the password.
Ah right got it
Also, you can't properly use a pepper with client side hashing and using a pepper is considered part of best practices.
Next idea, the hashing stays on server, but you send the client a random number and forces the client to do a proof of work of some kind, for example something bitcoin-like where they search a prefix or postfix that makes some hash have a given amount of leading zeros.
That’s relatively cheap to verify on the server side. And if the proof of work is more expensive than the server password verification check, it might dissuade attackers.
pow
that's how captchas slow down agents, making an attack more expensive. however, you need to balance the difficulty and consider a wide range of clients (slow devices, smartphones etc) to not accidentally impact UX
Yeah, that 100% would be a solution
Clearly ux matters, but it definitely would make a ddos significantly harder
Last updated: Jun 16 2026 at 16:19 UTC