News for hackers. Stuff that matters.
Re:Blake3 is 10 times faster than SHA-2 by littlestymaar on Saturday January 11, 2020 @05:44PM (#22022905)
This is a good time to ask for a question I have always wondered about these slow hash functions: are they slow because they are computationally intensive or is it that they have other tricks that makes them slow without costing too much load on your server (like needing RAM access, syscalls or anything that add latency but not much CPU load). If it's the former, isn't it a good DOS target, making your server busy hashing random crap and unable to process other requests?
Re:Blake3 is 10 times faster than SHA-2 by eyegor on Saturday January 11, 2020 @09:05PM (#22023944)
> are they slow because they are computationally intensive...

In general, no. Most "slow" hashing schemes are designed to be memory-hard and highly serial (more threads = more contention, not throughput). Some of the earlier approaches just try to maximize computational requirements, but modern research acknowledges the march of computing power makes that an inherently poor choice for long term sensitive data. Argon2 is just one of the more advanced versions of a memory-hard scheme, building on prior research. I could try to give a poor explanation, but instead I'll link you the spec which is very readable: https://github.com/P-H-C/phc-winner-argon2/blob/master/argon...

Re:Blake3 is 10 times faster than SHA-2 by littlestymaar on Sunday January 12, 2020 @02:46AM (#22025078)
Thanks!
Re:Blake3 is 10 times faster than SHA-2 by dpc_pw on Saturday January 11, 2020 @05:53PM (#22022955)
They are computationally slow, no tricks. The purpose is to prevent attackers from calculating the plain passwords if they actually got access to the content of your DB. They are not that slow (let's say less than a second to calculate) - fast enough for your user to not notice , slow enough so that attacker can't do gazillion tries per second with their GPU or something.

As per DOS: rate limit per ip and account, and it's not an issue.

Re:Blake3 is 10 times faster than SHA-2 by phiresky on Saturday January 11, 2020 @06:38PM (#22023243)
> They are computationally slow, no tricks

They have to and do use tricks, they aren't just slow. You could trivially make sha256 slow by just applying it a million times (that's not even parallelizable as well), but scrypt et al improve on that by making the algorithm also require a lot of RAM, use complex instructions (hard to recreate on a GPU or FPGA) and so on.

It's really hard to do very well, look at cryptocurrencies trying to be ASIC resistant: They want every normal person to be able to mine it, and don't want companies to be able to build a machine that can eclipse the mining power of everyone which means centralization.

Re:Blake3 is 10 times faster than SHA-2 by wongarsu on Saturday January 11, 2020 @05:57PM (#22022978)
They are computationally expensive. scrypt and Argon2 also depend on RAM access for their slowness, since that's much harder to parallelize (compute is easier to scale than RAM bandwidth). When your CPU can do hyperthreading that property might help recover some of that execution time.

It is a good DOS target, you should definitely rate limit logins to mitigate that. Other strategies are requiring captchas for login or letting the client execute the hash function and just doing a simple (fixed time) comparison on the server side.