crackmes/3/keygen.py

14 lines
373 B
Python
Raw Permalink Normal View History

2023-02-13 15:42:53 +00:00
import hashlib
username = input("Enter your username: ")
print(f"\nUsername: {username}")
2023-02-13 15:52:19 +00:00
hash = int.from_bytes(hashlib.sha256(bytes(username, encoding="ascii")).digest()[-4:], "big")
2023-02-13 15:42:53 +00:00
print(f"SHA256-derived bytes: {hex(hash)}")
target = hash ^ 0x2faecb0d
print(f"Target bytes: {hex(target)}")
password = target ^ 0xa2f99eae
2023-02-13 15:52:19 +00:00
print(f"Your password: {hex(password)[2:]}")