4
$\begingroup$

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?

$\endgroup$
4
  • 3
    $\begingroup$ 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. $\endgroup$ – President James K. Polk Feb 20 '12 at 18:08
  • $\begingroup$ thks greg. so, it's not possible to predict even if i know that half of key is "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" or "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" only? $\endgroup$ – user1221679 Feb 20 '12 at 18:15
  • $\begingroup$ 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). $\endgroup$ – ixe013 Feb 20 '12 at 18:23
  • $\begingroup$ 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. $\endgroup$ – Paŭlo Ebermann Feb 20 '12 at 20:02
4
$\begingroup$

Somewhat simplified, if that were possible, you would have found a vulnerability in SHA-256. The kind of attack you're talking about is called a preimage attack, ie figuring out information on the original message from the hash. There have been some attacks of that kind against a weakened version of SHA-256 but no successful ones against the standard algorithm.

Of course your MD5 only adds 128 bits of entropy and your other data one (either all a or all b), but a brute force attack against 129 bits isn't what you're looking for either.

$\endgroup$

Your Answer

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