Last active
March 18, 2020 21:52
-
-
Save jaames/7a4e4b51f7df218fff20087fedec7c55 to your computer and use it in GitHub Desktop.
Animal Crossing New Horizons font decryptor for .bfttf or .bfotf files
This file contains 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
# Animal Crossing New Horizons font decryptor for .bfttf or .bfotf files | |
# Usage: python3 bfttf.py input.bfttf output.ttf | |
from sys import argv | |
# might be other keys, who knows | |
key = [0x49, 0x62, 0x18, 0x06] | |
def xor(data, key): | |
offset = 0 | |
byte = data.read(1) | |
while byte: | |
yield ord(byte) ^ key[offset % 4] | |
offset += 1 | |
byte = data.read(1) | |
with open(argv[1], 'rb') as in_buffer: | |
# lazy way to get file length - seek to the end, get the position, then seek back to the start | |
in_buffer.seek(0, 2) | |
in_size = in_buffer.tell() | |
# skip 8-byte header(?) | |
in_buffer.seek(8, 0) | |
out_size = in_size - 8 | |
out_buffer = bytearray(out_size) | |
with open(argv[2], 'wb') as f: | |
f.write(bytes( [i for i in xor(in_buffer, key)] )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment