30 lines
764 B
Python
30 lines
764 B
Python
|
|
def hashfn(x: bytes) -> int:
|
||
|
|
h = 18446744073709551614
|
||
|
|
|
||
|
|
for (i, b) in enumerate(x):
|
||
|
|
h *= h * (b + 1)
|
||
|
|
k = 59275109328752 * (i + 1)
|
||
|
|
for j in range(8):
|
||
|
|
k ^= b << (j * j)
|
||
|
|
h += k
|
||
|
|
h %= (2 ** 64)
|
||
|
|
|
||
|
|
return h
|
||
|
|
|
||
|
|
|
||
|
|
print("It's not even worth trying, because bcrypt is perfect!")
|
||
|
|
print("Whatever, it's your time that you're wasting anyway...")
|
||
|
|
a = bytes(input("Message 1: "), 'utf-8')
|
||
|
|
b = bytes(input("Message 2: "), 'utf-8')
|
||
|
|
|
||
|
|
if a != b and hashfn(a) == hashfn(b):
|
||
|
|
flag = open('flag.txt').read()
|
||
|
|
print(
|
||
|
|
f"Congrats! Here's {len(flag)} characters of "
|
||
|
|
f"text for your hours of hard work: {flag}"
|
||
|
|
)
|
||
|
|
elif a == b:
|
||
|
|
print("Those are the same message...")
|
||
|
|
else:
|
||
|
|
print("Trivially false!")
|