News for hackers. Stuff that matters.
Re:The first chosen-prefix collision for SHA-1 by CiPHPerCoder on Tuesday January 07, 2020 @09:34AM (#21980223)
SHA-256 and SHA-512 are both in the same family (SHA-2).

Latacora says to use SHA-2. If you can get away with it, SHA-512/256 instead of SHA-256. But they're all SHA-2 family hash functions.

https://latacora.micro.blog/2018/04/03/cryptographic-right-a...

No need to bikeshed this. But if you must: SHA-512/256 > SHA-384 > SHA-512 = SHA-256

If you're wondering, "Why is SHA-384 better than SHA-512 and SHA-256?" the answer is the same reason why SHA-512/256 is the most preferred option: https://blog.skullsecurity.org/2012/everything-you-need-to-k...

Additionally, the Intel SHA extensions target SHA1 and SHA-256 (but not SHA-512), which makes SHA-256 faster than SHA-512 on newer processors.

Isn't crypto fun?

Re:The first chosen-prefix collision for SHA-1 by colanderman on Tuesday January 07, 2020 @10:58AM (#21981147)
I'm super confused. Are SHA-256 and SHA256 different, and if so, why in the world would this be considered a sane naming scheme?

If not, I completely do not understand the inequation you wrote, which seemingly lists SHA-256 (and -512) multiple times.

Re:The first chosen-prefix collision for SHA-1 by timdumol on Tuesday January 07, 2020 @11:03AM (#21981200)
You're probably confused by "SHA-512/256", which does not mean SHA-512 or 256, but rather a truncated version of SHA-512: https://en.wikipedia.org/wiki/SHA-2 in the third paragraph.
Re:The first chosen-prefix collision for SHA-1 by Ajedi32 on Tuesday January 07, 2020 @12:04PM (#21981874)
So why would a truncated version of SHA-512 be better than SHA-512? And why is SHA-512 = SHA-256?
Re:The first chosen-prefix collision for SHA-1 by CiPHPerCoder on Tuesday January 07, 2020 @12:26PM (#21982124)
Truncated hash functions are not vulnerable to length-extension attacks.

Length-extension attacks are relevant when you design a MAC by passing a secret and then a message to a hash function, where only the message is known.

Truncating the hash (which is what SHA-512/256 and SHA-384 do to SHA-512) removes the ability to grab an existing hash H(k || m) (where k is unknown and m might be known) and append junk because a truncated hash does not contain sufficient information to recover the full state of the hash function in order to append new blocks.

Re:The first chosen-prefix collision for SHA-1 by p1mrx on Tuesday January 07, 2020 @01:37PM (#21983041)
Why do SHA-512/160 and SHA-512/128 not exist? They could be useful as drop-in replacements for SHA1 and MD5.
Re:The first chosen-prefix collision for SHA-1 by SAI_Peregrinus on Tuesday January 07, 2020 @02:22PM (#21983613)
Because 224 bits is considered the minimum safe output length for a general purpose hash function. So they'd be drop-in replacements but still wouldn't be safe. Safer than MD5/SHA1, but not actually safe.

So rather than push off getting people to make things actually safe by providing a footgun NIST just didn't do that.

Re:The first chosen-prefix collision for SHA-1 by p1mrx on Tuesday January 07, 2020 @03:03PM (#21984172)
> 224 bits is considered the minimum safe output length for a general purpose hash function.

Considered by whom?

Re:The first chosen-prefix collision for SHA-1 by CiPHPerCoder on Tuesday January 07, 2020 @04:15PM (#21984955)
Truncating a hash function to 224 bits put it at the 112-bit security level, which is roughly equivalent to 2048-bit RSA under today's understanding of the costs of distributed cracking attacks.

There are a lot of standards organizations all over the world with various recommendations. https://www.keylength.com collates quite a few of them. Pick the one most closely relevant for your jurisdiction.

Most of them recommend 2048-bit RSA as their minimum for asymmetric security, and AES-128 / SHA-256 as their minimum for symmetric security. This is a [112, 128]-bit security lower bound.

Truncating a hash to 160 bits yields 80-bit security, which is insufficient. 128 bits (64-bit security) is out of the question.

Re:The first chosen-prefix collision for SHA-1 by p1mrx on Tuesday January 07, 2020 @11:17PM (#21988273)
"Cryptographic hash functions with output size of n bits usually have a collision resistance security level n/2 and preimage resistance level n."

Depending on what you're doing, "SHA-512/128" could have a 128-bit security level. But I guess it's safer to assume n/2 when making a general recommendation.

Re:The first chosen-prefix collision for SHA-1 by tedunangst on Tuesday January 07, 2020 @02:13PM (#21983496)
You can truncate a hash anywhere you like. But 128 bits is considered too short now.
Re:The first chosen-prefix collision for SHA-1 by colanderman on Tuesday January 07, 2020 @12:26PM (#21982125)
Ah! Makes sense now, thanks.
Re:The first chosen-prefix collision for SHA-1 by CiPHPerCoder on Tuesday January 07, 2020 @11:22AM (#21981397)
I've edited my parent comment to consistently use hyphens.

There are six SHA-2 family hash functions:

  * SHA-224
  * SHA-256
  * SHA-384
  * SHA-512
  * SHA-512/224
  * SHA-512/256
Hope that helps. (I know it's still confusing.)
Re:The first chosen-prefix collision for SHA-1 by dlgeek on Tuesday January 07, 2020 @11:04AM (#21981218)
SHA-512/256 is a truncated SHA-512 that's shortened to 256 bits, it's a separate standard.
Re:The first chosen-prefix collision for SHA-1 by faceplanted on Tuesday January 07, 2020 @11:14AM (#21981330)
"SHA-512/256" is a single entity
Re:The first chosen-prefix collision for SHA-1 by rurban on Tuesday January 07, 2020 @07:43PM (#21987024)
I would rather call them AMD extensions, because you would only find them in all used AMD Rome style processors (Epic, Ryzen, Threadripper) but not in any useful Intel processor, but Goldmont (ie cheap Laptops).
Re:The first chosen-prefix collision for SHA-1 by fireflash38 on Tuesday January 07, 2020 @10:45AM (#21981012)
I read the blog, but it doesn't really expand on why SHA224/384 aren't vulnerable to that attack, can you explain (or link to some place that does?)
Re:The first chosen-prefix collision for SHA-1 by tptacek on Tuesday January 07, 2020 @12:35PM (#21982243)
A length-extension attack works by taking the output of a hash and using it as the starting point for a new hash; you can do this even for hashes of messages you haven't seen, minting new related hashes. Truncated SHA-2 hashes don't output the whole hash, and so you aren't given enough information to start a new related hash.
Re:The first chosen-prefix collision for SHA-1 by CiPHPerCoder on Tuesday January 07, 2020 @11:25AM (#21981426)
Because they're already truncated.

SHA-384 is SHA-512 with a different IV (which doesn't affect LEAs) truncated to 384 bits (which gives you 128 bits of resistance against LEAs).

SHA-224 is the same story but with SHA-256 instead (and only 32 bits of LEA resistance).