Last active
April 6, 2023 19:18
-
-
Save dogtopus/4c5f2d4da4567b6204435ca335e63e0a to your computer and use it in GitHub Desktop.
Kagiya? What's that
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
def secret(start: int, size: int) -> bytes: | |
result = bytearray() | |
add = start + size | |
for i in range(size): | |
result.append(start & 0xff) | |
next = start + add | |
add = start | |
start = next | |
return bytes(result) | |
SECRET = secret(-3, 10) | |
def derive(tid: bytes, passphrase: bytes) -> bytes: | |
tids = hashlib.md5(SECRET + tid.lstrip(b'\x00')).digest() | |
return hashlib.pbkdf2_hmac('sha1', passphrase, tids, 20, 32) | |
if __name__ == '__main__': | |
print(derive(bytes.fromhex('000100014e414150'), b'nintendo').hex()) | |
print(derive(bytes.fromhex('000100014e414150'), b'mypass').hex()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment