Can I use neural network to identify a hash function like sha256? I mean, generate a bunch of hash codes by different hash functions and also labels. Then, feed these codes into a neural network. Will it work?


No. The output of a cryptographic hash function (like SHA256) is indistinguishable from random data. The only feature that'd be useful to a neural network would be the length of the hash -- and you don't need a neural network to tell you that a 256-bit value could be SHA256.

  • Is there any requirement that a secure hash function is indistinguishable from random? That seems intuitive to me for a good hash function as it leads to a more even distribution for preventing collisions, but does it lead from any of the usual requirements of hash functions (pre-image, second pre-image, and collision resistance)? – Steve Jan 9 at 3:49
  • @Steve Effectively, yes. Standard measures of collision resistance assume that all hash outputs are equally probable. For a hash function to be distinguishable from random data, some hashes would have to be more probable than others, or even entirely impossible. – duskwuff Jan 9 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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