-

@ 4e6d01d6:3d6224c4
2025-02-22 22:51:16
to begin with breaking sha256, we need to find statistically significant pattern in probabilities of bit changes in output.
here is llm assisted code that calculates these probabilities. its not checked that well so it may or may not be correct. at least should work for starting point.
//
import hashlib
CHECK_INTERVAL = 10000
def sha256_binary(input_bytes):
sha256_hash = hashlib.sha256()
sha256_hash.update(input_bytes)
return sha256_hash.digest()
def calculate_bit_change_probability(results, curr_result):
num_bits = len(curr_result) * 8
bit_change_count = [0] * num_bits
for result in results:
int_list1 = list(result)
int_list2 = list(curr_result)
xor_int_list = [a ^ b for a, b in zip(int_list1, int_list2)]
xor_bytes = bytes(xor_int_list)
xor_result = int.from_bytes(xor_bytes, byteorder='big')
for i in range(num_bits):
if (xor_result >> i) & 1:
bit_change_count[i] += 1
total_comparisons = len(results)
probabilities = [count / total_comparisons for count in bit_change_count]
return probabilities
def main():
results = []
i = 0
while True:
i += 1
input_bytes = i.to_bytes((i.bit_length() + 7) // 8, byteorder='big')
hash_result = sha256_binary(input_bytes)
if (i + 1) % CHECK_INTERVAL == 0:
probabilities = calculate_bit_change_probability(results, hash_result)
print(f"Iteration {i}: Bit change probabilities:")
print(f"{', '.join([str(p)[:7] for p in probabilities])}")
results.append(hash_result)
main()