Skip to content

Instantly share code, notes, and snippets.

@CodingFu
Created May 12, 2023 17:16
Show Gist options
  • Save CodingFu/4991c9a363ffc68aba3a2df33e0f0e07 to your computer and use it in GitHub Desktop.
Save CodingFu/4991c9a363ffc68aba3a2df33e0f0e07 to your computer and use it in GitHub Desktop.
WTF?
import hashlib
import random
with open("./w.txt", "r") as f:
a1 = f.readlines()
a1 = [w.strip() for w in a1]
a2 = [random.randint(0,2047) for i in range(0, 11)]
a3 = [n - 1 for n in a2]
a4 = [a1[n] for n in a3]
a6 = "".join([format(n, "011b") for n in a3])
def f4(a):
b4 = hashlib.sha256(int(a, 2).to_bytes(16, byteorder='big')).hexdigest()
return format(int(b4[0], 16), "04b")
def f5(a):
return format(int(a, 2) ^ 0, "0132b")
for i in range(0, 127):
b1 = format(i, "07b")
b2 = a6 + format(i, "07b")
b4 = int(b1 + f4(b2), 2)
b5 = f5(b2)
b6 = b5[:-4]
b7 = b5[-4:]
if f4(b6) == b7:
print("====FOUND====", i)
print("OK: ", a4, a1[b4])
b8 = [a1[int(b5[i:i+11], 2)] for i in range(0, len(b5), 11)]
print("SK: ", b8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment