make keygen a bit neater

This commit is contained in:
Jack Bond-Preston 2023-02-13 15:52:19 +00:00
parent e341625a66
commit 76aec13bff
Signed by: jack
GPG Key ID: 010071F1482BA852

View File

@ -1,14 +1,13 @@
import hashlib import hashlib
username = input("Enter your username: ") username = input("Enter your username: ")
print(f"\nUsername: {username}") print(f"\nUsername: {username}")
hash = int(hashlib.sha256(bytes(username, encoding="ascii")).hexdigest()[-8:], base=16) hash = int.from_bytes(hashlib.sha256(bytes(username, encoding="ascii")).digest()[-4:], "big")
print(f"SHA256-derived bytes: {hex(hash)}") print(f"SHA256-derived bytes: {hex(hash)}")
target = hash ^ 0x2faecb0d target = hash ^ 0x2faecb0d
print(f"Target bytes: {hex(target)}") print(f"Target bytes: {hex(target)}")
password = target ^ 0xa2f99eae password = target ^ 0xa2f99eae
print(f"Your password: {hex(password)[2:]}") print(f"Your password: {hex(password)[2:]}")