Say I have three 64 byte values that I hash into three sha256 hashes (H1, H2, H3). The data does not contain any secrets and it all public data. I am instead hashing the data for integrity purposes.

Now lets say I do the following:

CombinedHashesValue = H1(as bigInt) + H2(as bigInt) + H3(as bigInt)

H4 = sha256(CombinedHashesValue)

Lets call H4 our FinalHash. One of the features of this hash is that it is position independent because adding is communicative.

Now say I want to be able to prove that I know one of the 64 byte chunks of data that makes up the FinalHash. Lets say the 64byte chunk I know is for H3 above.


ProposedH3 = sha256(64bytesOfData)

PropsosedCombinedHashesValue = H1(as bigInt) + H2(as bigInt) + ProposedH3(as bigInt)

ProposedFinalHash = sha256(ProposedCombinedHashesValue)

If ProposedFinalHash == FinalHash {
  print "ok great!"
else {
  print "Nope"

What about this approach might:

  1. Reduce the security of each hash or the final hash
  2. Increase the chances of collision, PreImage attacks, etc
  3. Something else I am not thinking of

I can barely math let alone understand cryptography so I am asking this question because I am pretty sure I am doing something incredibly wrong and short sighted and thus am seeking feedback.



1 Answer 1


Now say I want to be able to prove that I know one of the 64 byte chunks of data that makes up the FinalHash

This doesn't do that; as it is easy to "prove" almost any string as data that makes up the FinalHash.

You make up the string you want to prove, say, "FooBar"; you hash it, and pick two 32 byte values which sum to the value $ProposedCombinedHashesValue - Hash(\text{"FooBar"})$; propose those as your H1, H2 values and there you go.

It also reduces the difficulty of finding a preimage to the normal SHA256 strength against collisions - probably still strong enough, but definitely weaker than it was before.


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.