init
This commit is contained in:
commit
897272d7c1
5 changed files with 167 additions and 0 deletions
29
bcrypt.ctf.py
Normal file
29
bcrypt.ctf.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
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!")
|
||||
Loading…
Add table
Add a link
Reference in a new issue