Let's define "breaking" a hash function $H$ as being threefold (corresponding to the main properties of a cryptographic hash function):
- preimage attacks to get $m$ knowing $H(m)$
- second-preimage attacks to find some $m'\neq m$ knowing $m$ so that $H(m)=H(m')$
- collision attacks to find $m_1,m_2\neq m_1$ for $H(m_1)=H(m_2)$
I wonder how much computational resources would in theory be required for performing each attack on SHA-256. I have little experience with complexity theory, but could not find much literature on this.
My approach was this: in general, there are $2^{256}$ possible hashes. Since there is no known structural weakness in SHA-2, brute-forcing a preimage is the only option and should take $2^{255}$ trials (half of the hash space). However most refer to $2^{256}$, is that because that means certain success rather than expected time needed?
A collision takes $2^{128}$ steps with a Birthday attack. I could not find figures for the second-preimage attack.
First of all, are my assumptions above correct? What would the complexity of the three attacks be?
I am also curious what "unit" a number like $2^{256}$ implies - is it something like floating-point operations that would be needed to run?
I am aware that SHA-256 is deemed secure given today's computational power. is it likely that increasing computer capacities (classical, not quantum computing) will become a threat to this over the next years?