1
$\begingroup$

I wrote SHA-256 with arrays of integers representing the bits (e.g. [1,0,...,1]), and then I altered it to accept partial values (e.g. [0.5, 0.79, 0.0, 1]), as in each value has an x chance of being '1' and a 1-x chance of being '0'. The hope was to be able to change my input by less than 1 bit at a time to violate the avalanche property, allowing me to run a search for a given hash.

My problem is that all the values tend towards 0.5. With 512 random.random() inputs last few values in W are 0.5, and by iteration 8/64 all 256 hash values a-h are either 0.5 or very very close to 0.5. If I give very big/small values, like 0.999999, then it stays at 0.9999 or 0.00001 for a while, but then flips to 0.5.

What I was hoping for is something like:

[0,0,0,0...] -> [1,0,0,...]
[1,0,0,0...] -> [1,0,1,...]
[0.5,0,0...] -> [1,0,0.5,...]
but instead I would get 
[0.5,0,0...] -> [0.5,0.5,0.5,...]

My code is [in GitHub](https://github.com/YaBoiBreezy/python-sha-256-integer-arrays]. As far as I can tell my probabilistic operations are correct. Is my method just inherently impossible for hashes due to the ability of XOR and '+' to obscure data?

$\endgroup$

1 Answer 1

2
$\begingroup$

The attack method you describe is infeasible for hashes that manifest the avalanche property. This property demonstrably changes close to 50% of the bits each time you change your original message.

When you are using fuzzy logic, averaging many fuzzy bits will yield the expected "close to" 0.5 values at the hash output.

$\endgroup$

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.