How to encrypt and decrypt save Resource file

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Ethan63

If I save my game data in .tres format, is it possible to encrypt and decrypt the data? Anyone know how to do this? I can’t find any tutorial/ documentation. Thanks in advance d

:bust_in_silhouette: Reply From: yrtv

https://docs.godotengine.org/en/stable/tutorials/io/encrypting_save_games.html

Can you show me how it works with resource file?

Ethan63 | 2021-02-17 00:54

Why do you want first store data in unencrypted form, and when encrypt them? Data can be changed between steps. Write whatever you write in .tres now into encrypted file directly.
If you want to encrypt existing saves read .tres content into var, and save content into a new encrypted file.

yrtv | 2021-02-17 16:00

Wow, thank for your help :). Silly me why do not think in this way xd. So before I save the data into the .tres file, I can encrypt the data with custom script. The reverse for loading the data back into the game. I will definitely try it out . Thank you.

Ethan63 | 2021-02-18 01:06