Skip to content

Instantly share code, notes, and snippets.

@jix
Forked from DavidBuchanan314/sha256_53XOR.py
Last active May 1, 2023 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jix/a58666e2283f62c1dd53b83f6bd3a265 to your computer and use it in GitHub Desktop.
Save jix/a58666e2283f62c1dd53b83f6bd3a265 to your computer and use it in GitHub Desktop.
import hashlib
from functools import reduce
inputs = """\
4987a884
dc917386
54c4938a
dcf3388d
22e1e08f
02e29593
bae48794
13953895
3ba33a95
1a89f895
83ace797
98bd5299
967e099a
1882d79a
414e2b9b
6f3ba69d
72000000
77000000
7b000000
7c000000
8c000000
8f000000
94000000
95000000
97000000
96000000
98000000
9d000000
9e000000
9f000000
a0000000
a3000000
b0000000
af000000
b3000000
c0000000
c2000000
c4000000
cc000000
c7000000
cb000000
d1000000
e3000000
e5000000
e8000000
ea000000
f1000000
f2000000
fc000000
fd000000"""
def xor_bytes(a, b):
return bytes([x^y for x, y in zip(a, b)])
hashes = [hashlib.sha256(bytes.fromhex(x)).digest() for x in inputs.split("\n")]
xor_result = reduce(xor_bytes, hashes)
print(f"The XOR of all {len(hashes)} hashes is:")
print(xor_result.hex())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment