Users browsing this thread: 1 Guest(s)
XOR First Bytes of Files Automatically
#2
You can use a Python script. You can ask ChatGPT to help write it if you don't know how. Here's what it gave me (which looks fine to me)

Code:
import sys

# Put what you want to xor with here
magic_string = b'XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX-'

# Open the file in read and write mode (binary)
with open(sys.argv[1], 'r+b') as file:
    # Read the first 32 bytes
    header = bytearray(file.read(32))
   
    # XOR the file data with the magic string byte by byte
    for i in range(32):
        header[i] ^= magic_string[i]
   
    # Move the file pointer back to the beginning
    file.seek(0)
   
    # Write the modified data back to the file
    file.write(header)

After installing Python, you can call it from the shell like python path/to/script.py path/to/input/file. You should be able to iterate over your files in powershell and call it for each one. Note that it will modify the input file in place, but you can change that if you want of course.
3D Screenshot Tools (NDS / N64 / PS1 / PS2)
Other Tools (apicula / Vagrant Story / Star Ocean Blue Sphere)
Reply
Thanked by: Lillyth-Sillyth


Messages In This Thread
RE: XOR First Bytes of Files Automatically - by scurest - 11-30-2024, 03:35 PM

Forum Jump: