sha256 uses many binary operations where you lose information, specifically “and” and addition (which is basically just xor + and) operations. If the result from an “and” operation is 0 the only thing you know is that one of the operands must be 0 but you don’t know which one or if both are 0. Same for “or” but if the result is 1. This might not sound overly difficult to reverse but this is the main essence of what happens. The algorithm works something like this:
1. The binary values of the original message is shuffled, padded and modified then cut into groups of 32 bits. Let’s call them message bits.
2. Then 8 groups of 32 specific bits are set up, call them result bits. You take the first group of message bits and do one iteration of irreversible binary operations with the result bits. The result of these operations will now be the new result bits.
3. Take the second message group and perform the same operation on the new result bits. Do this for every group 64 times and you will have your final result bits which is the hashed result.
The result can not be predicted. Any slight variation will completely change the result. And yes there will always be at least 64 message groups of bits, even for short messages. The reason is because there will be at most 16 bit groups that are unique from the original message. The other 48 are generated from the other message groups, with more irreversible operands like “and” but also bit shifting. This also means that the 64th message groups will depend on a set of groups that will depends on a set of groups that will depend on a set of group and so on until that message group is actually part of the original message. A numerical nightmare to reverse.
If the original message is shorter than 16*8 bits it will get padded with 0s. If the message is very long then you will perform step 2 and 3 several times, which basically means that you modify the result bits 64*n times.
Just mathematically describing the solution of one bit is not possible, let alone solving it with any existing computer.
Latest Answers