News for hackers. Stuff that matters.
Re:Show HN: SHA-256 explained step-by-step visually by floodyberry- on Monday February 07, 2022 @01:40PM (#30249079)
Generally, come up with a set of operations that you want to use that meet your design criteria (fast in hardware, fast in software, fast in SIMD, whatever), then brute-force the instruction order and/or arbitrary constants (rotations) to minimize known attacks and maximize diffusion

e.g. the Chacha20 design document explains the choices made in a fairly high level and easy to understand way: https://cr.yp.to/chacha/chacha-20080128.pdf

Re:Show HN: SHA-256 explained step-by-step visually by dr_zoidberg on Tuesday February 08, 2022 @06:45AM (#30257322)
> (fast in hardware, fast in software, fast in SIMD, whatever)

"Slow to compute in GPUs" has been another design criterion for a while. It helps against brute force attacks. Of course, you might want your hash to be fast on GPUs too, if you're trying to accelerate something, bu cryptographic hashes usually aim for attack resistance.

Re:Show HN: SHA-256 explained step-by-step visually by tptacek on Tuesday February 08, 2022 @11:06AM (#30260095)
No, no, no. That's a criteria for password hashes, which are a totally different construction than standard cryptographic hashes. You can't brute force a cryptographic hash, practically by definition.
Re:Show HN: SHA-256 explained step-by-step visually by dr_zoidberg on Tuesday February 08, 2022 @11:26AM (#30260373)
I must have conflated Keccak's "slow without specific hardware/extensions" with "slow on purpose against GPUs". Both are similar (why would a GPU have an operation for cryptography?) but obviously not the same thing.
Re:Show HN: SHA-256 explained step-by-step visually by dllthomas on Tuesday February 08, 2022 @12:49PM (#30261729)
The distinction being the relatively small space of possible preimages?
Re:Show HN: SHA-256 explained step-by-step visually by orra on Tuesday February 08, 2022 @08:15AM (#30257979)
I’m surprised that’s a design crtieria. Being able to calculate hashes quickly is advantageous.

Speeding up hashing by, what, a few orders of magnitude shouldn’t break your ≥ 128 bits of preimage protection, surely?

Re:Show HN: SHA-256 explained step-by-step visually by jfindley on Tuesday February 08, 2022 @08:27AM (#30258090)
It depends what the goal of your hashing function is. Pure cryptographic hashes like sha256 want to be cheap to calculate. Slow on GPUs is only a design goal if you're making a password hash function, which is a rather different class of problem to sha256/chacha20 and similar.

I think the commenter you're responding to got a little confused somewhere along the way and conflated cryptographic hashes with password hashing.

EDIT: To be clear, password hashes are also cryptographic hashes - but they're a specific subclass of crypto hashes with different design criteria.

Re:Show HN: SHA-256 explained step-by-step visually by dr_zoidberg on Tuesday February 08, 2022 @05:01PM (#30265421)
Yes, I did confused the part about Keccak[0] being "slow" to compute without specfic hardware/extensions with it being slow on GPUs as a design goal.

[0] Taking this as an example of newer crpytographic hashes, rather than the "old ones" that were easier/faster to calculate on GPUs.

Re:Show HN: SHA-256 explained step-by-step visually by MontagFTB on Tuesday February 08, 2022 @09:02AM (#30258453)
This is a known technique for password hash protection too. By limiting the usefulness of the GPU, you shield yourself from high speed password crackers in the event your password database is compromised.