# Can one group the SHA-256 outputs depending on partial inputs?

Is it possible to predict a hash key based on half key? Let's have some example:

I have 100000000 hash results, and they are generated by either

sha256( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" . md5(random()) );


or

sha256( "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" . md5(random()) );


So, when someone generates a new hash (based on method "aa" ou method "bb"), is there any way that I can predict if hash is more a "aa" generated type or more a "bb" one?

I have already tried some type of Bayes classification, because I know that can only be there 2 types of results. But for each result I cannot classify hashes so that I have a good Bayes training.

Is this theoretically possible?

-

## migrated from stackoverflow.comFeb 20 '12 at 18:37

This question came from our site for professional and enthusiast programmers.

A secure hash function, or even a not so great hash function, is not going to exhibit any of the properties you are looking for. –  GregS Feb 20 '12 at 18:08
thks greg. so, it's not possible to predict even if i know that half of key is "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" or "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" only? –  user1221679 Feb 20 '12 at 18:15
I dont know the answer, but I the security properties you are up against are : confusion (change 1 bit and about 50% of the bits change) and diffusion (change 1 bit and changes will be distributed evenly, given enough input). –  ixe013 Feb 20 '12 at 18:23
Welcome to Cryptography Stack Exchange. Your question was migrated here because of being not directly related to software development (the topic of Stack Overflow), and being fully on-topic here. Please register your account here, too, to be able to comment and accept an answer. –  Paŭlo Ebermann Feb 20 '12 at 20:02