Reading / writing from a file is going to be slower than whatever transformation you do with it.
I would recommend you use base64 encoding if all you want is to stop people from just opening with a text editor, but don't care about real security.
If you want performance, then write it in chunks, convert a chunk to base64, the async write it to the buffer, in a loop.
But remember, if it's something the users may like to edit, but you don't care about doing full encryption, then leave it as plain text and let them modify it easily!
My files are written with a buffer, a mix of binary values(u8, u16, u32 and f32) and strings for variable names and stuff, so they're not really editable in a text editor anyway. So I just wanted to make all of it unreadable cus it looks better than a bunch of non-letters and words mixed together.
But if I can encode it using base_64 to to achieve this, or just write a 2 byte bom at the start, I'd rather do the second cus the saving and loading time
will be much less.
Anyway, all the source code the engine uses for loading and saving the different files is available for people to use, in the project(warp3d)
So, I'm not bothered about the files being editable, in fact I'd be glad if people made programs that can edit them, similar to fbx, obj etc.
And having encryption with every file would completely ruin people being able to share files(levels and models) with eachother.
The only time I'm concerned with encryption is for when someone has completed a game and wants all the files to be encrypted, so I'm thinking of making a separate tool that encrypts them with a certain key, and the key would have to be written somewhere in the project's gml code and compiled into the exe. I'm guessing this still wouldn't be that hard for a hacker to retrieve, especially if they had access to the source code. But I don't really know how important this would be to most developers anyway, cus every game ends up being hacked if someone really wants to get into it.
But I'm definitely gonna be working on the best encryption method I can think of, but that has nothing to do with this thread lol
Also, I thought of a way to rephrase what I said at first to hopefully make it as straightforward as possible:
Some people would want to encode a buffer before saving it so all the strings in it aren't readable by the human eye.
But doing this will slow down the saving and loading process, especially when decoding it back when loading.
So instead, they can just set a byte order marker at the start of the file.
It achieves the same goal of the strings not being readable by the human eye, but is a heck of alot faster, and they don't have to decode it back when loading, just ignore the first 2 bytes.
I also want to state that this method is even less secure than using base_64, so it's purely for the way a file looks when opened in notepad