Would it be possible to find a correlation between the inputs of SHA 256 and it's outputs? More specifically, by using deep learning, would there exist a correlation between the inputs of an SHA 256 algorithm and it's expected output?

For example, given that A, B, C and D output a Has with certain characteristics, and given that we have a very big sample of data that has a combination of inputs and their outputs (labeled based on whether the output FITS into the characteristics or not), could a pattern be found so that in the future we could know which combination of inputs would give us an output that complies with said characteristics?

Thanks in advance!

  • 4
    $\begingroup$ I think you're effectively asking about whether it's possible to find a differential cryptanalysis attack that works on a non-reduced-round version. Machine learning isn't magic, and isn't really relevant to this field, so it somewhat confuses the question. $\endgroup$ Commented Jan 17, 2018 at 1:09

1 Answer 1


The output of hash functions is commonly indistinguishable from random (randomness of the output is not a direct requirement for secure hash functions); this is certainly the case for SHA-256. So trying to find any correlation between inputs should be impossible - if there is some kind of pattern on different inputs it was created by chance.

If you would find such a correlation then the hash function would be considered broken. Deep learning should therefore be considered another way of attacking the hash using machine learning, as the comment from SAI Peregrinus indicates.

An important note in this case is that Merkle Damgard constructions such as SHA-256 are susceptible to length extension attacks, which means that SHA-256 is not a random oracle. That won't help you finding a pattern in separate input messages so I don't think it should influence this answer.

  • $\begingroup$ Hi Marteen, thanks for your answer. It was very informative. So, in order to summarize my understanding after reading your answer, it would be impossible to correlate inputs of SHA-256 with their outputs because the output, even though it's deterministic, behaves randomly? (As in, it's not possible to predict what the output of a HASH function would be unless running it). Sorry if my questions are too elemental, i'm just starting to learn a bit about cryptography. Thanks! PS: When i mean finding a pattern, it's between a set of inputs and their outputs. $\endgroup$ Commented Jan 17, 2018 at 22:14
  • $\begingroup$ Yeah, that's it. The first paragraph leaves some doubt about it, I'll revisit the answer later. $\endgroup$
    – Maarten Bodewes
    Commented Jan 18, 2018 at 10:29
  • $\begingroup$ (it is of course pseudo random, it depends on the input - but there are no ways other than to go through the hash function in some form or other to obtain the result) $\endgroup$
    – Maarten Bodewes
    Commented Jan 18, 2018 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.