how do I encrypt/decrypt saved data

I would like to be able to save data when panda is used. So far, I have been writing to a text file using python’s usual file read-write methods. I would like to be able to encrypt the data saved so that users won’t be able to edit it outside of the application.

I have noticed that Panda comes with two executables pencrypt.exe and pdecrypt.exe, but I am not sure how I would be able to read or write encrypted data in-code. Is pencrypt/pdecrypt used for something else entirely?

I would really like to avoid writing rudimentary encryption and decryption algorithms in python myself, so I was wondering if Panda has already been be able to accomplish this.

The simplest answer is to use Panda’s encryptString() and decryptString() global functions, which can operate on the contents of a file produced by pencrypt. You can feed a big string–for instance, the entire contents of a file–to either of these functions.

You can also transparently read and write encrypted data within a multifile, but since you are writing your own data files at runtime, probably encryptString() is a better choice.

Note, of course, that this is only secure as long as your users are not able to discover your encryption password, which must be available to your application.