What I know so far
Fact 1) I know that all cryptographic hash functions have the following properties
They are many-to-one in nature
They produce fixed size outputs
Given an output
x
it is infeasible to find the original messagem
such thatH(m) = x
Fact 2) I know that certain cryptographic hash functions are "stronger", but more "expensive" to compute than others - in the sense that trying to overcome their (Property 3) is a lot harder and time consuming/resource intensive.
sha512(m)
is harder to crack thansha256(m)
which is in turn harder to crack thansha224(m)
Fact 3) I also know that certain cryptographic hash functions perform worse on verifying a message's integrity than a simple CRC checksum. (According to the following stackexchange post)
A cryptographic hash truncated to 32 bits can easily collide with two inputs that differ in only one or two bits, whereas a CRC won't. The CRC is geared towards reliably detecting error patterns that commonly occur in transit, so it will do better on those kinds of errors and worse on others. The short hash does optimally over all inputs, and as a result does worse than CRC on the inputs CRC is good at dealing with.
What I want to know
Question 1) What common hash functions are worse than CRC checksums, and which are better than them in verifying integrity? (e.g. file corruption/changes).
Question 2) Is it the case that the stronger the cryptographic hash function, the better it is at verifying integrity? (e.g. sha512
will be able to detect file changes better than sha256
).
sha256(m)
(is) harder to crack thansha224(m)
" w.r.t. an attack that attempts to "find the original messagem
such thatH(m) = x
". If a human usesm
as password, a very practical brute force attack (e.g. with a GPU farm) has excellent chances to succeed, and there's no difference in difficulty. Also, if there was some cryptanalytical weakness in SHA-256 (we have no reason to believe that), and form
random of suitable size (say 8 to 16 random bytes), it would be likely that the truncation at the end of SHA-224 mitigates that weakness. $\endgroup$