phasmoeditor
phasmoeditor copied to clipboard
Error decrypting...
I've done a bit of experimenting using Python and it seems like this error randomly happens after using ALT+F4 to exit the game causing the save file to fail decrypt.
I suspect and figure it's because randomly parts of the JSON file are missing or unfinished.
Example
"SanityMedication1Tier" : {"__type" : "int","value" : 0},"SoundSensor1Tier" : {"__type" : "int","value" : 0},"Tripod1Tier" : {"__type" : "int","value" : 0},"Loadout0Name" : {"__type" : "string","value" : "Loadout 1"},"Bone7" : {"__type" : "int","value" : 1}, <-- (Random unexpected JSON)
My experiment in trying to fix this.
def _decryptFile(self, data):
try:
if not data:
return None
iv = data[:16]
decipher = AES.new(
hashlib.pbkdf2_hmac('sha1', b't36gref9u84y7f43g', iv, 100, dklen=16),
AES.MODE_CBC,
iv
)
decrypted = decipher.decrypt(data[16:])
clean_decrypted = ''.join(chr(byte) for byte in decrypted if 32 <= byte <= 126)
clean_decrypted = re.sub(r'"playedMaps"(\s|)\:(\s){\s*.*\s*.*\s*.\s*.*\s*', '', clean_decrypted)
print(clean_decrypted)
return clean_decrypted
except Exception as e:
print(e)
return None
I guess the only solution at the moment is to run the output through a JSON repair API or function to try to remove any decrypt artifacts or any oddities.