# Quick Question on File Systems

This topic is 5071 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok so I am working on my own file system. All is well but I have a quick question on the logic workings of it - would it be more logical to:
1. Compress all files using ZLIB first, then add them into the single '.dat' archive, and finally use TEA to encrypt it
or
2. Add all files into the single '.dat' archive first, then ZLIB that file, and finally use TEA to encrypt it
I would like to know any opinions before I take either route because I am not yet on the part of adding the files into the archive yet, but it is something I was thinking about right now. Thanks for your time! - Drew

##### Share on other sites
For me, it would be more intuitive to compress each file, then add them to the archive, then encrypt the archive. (Option 1) That way, when you work with the packed file, you don't need to uncompress everything to work with possibly only one file. It's a matter of speed, and it would take a lot longer than necessary to use the latter method.

I'm assuming that this is for a game or graphics application, where the data is large and the speed counts, but it really doesn't matter. The second method offers nothing except a bit more data to work with for compression, which I would assume (?) would have a negligible effect on the amount of compression possible.

##### Share on other sites
Ahhh great point! Thanks, I didn't even think about that. With that said I have revised the model a bit:

1. Compress all files using ZLIB first
2. Encrypt with TEA
3. Add all into single .dat archive

Like you said, I could only be working with single files at a time and not have to worry about decompressing/decrypting *everything*. That makes sense now [smile].

- Drew

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634088
• Total Posts
3015449
×