0

In Java I'm writing a data file that is essentially a save file. I know if I write the file as a .dat (UTF-8) when I open the file in a text editor the numbers are unreadable. In the same file text is completely readable. Is there a file format I can use that makes text unreadable in a text editor?

For the moment I am aware of .txt and UTF-8 as writable (and readable) file formats.

Additional information.

I have a class in Java that reads in a .csv file that I generate in a separate program. I use the class to write a file that I subsequently use as a read file in my Java project. In my class I can write a .txt file that literally just translates the .csv file into a .txt file. If I use UTF-8 encoding then all the numbers essentially aren't identifiable if I open the file in a text editor. What I'm looking for is there an encoding I can use (in the Java libraries) that when I write them to my own file becomes essentially unreadable in a text editor.

I'm not looking to change a file extension, and I'm not wanting to make it uneditable as the UTF-8 stops it being edited as far as I could tell. I was just wondering whether there was an encoding type I could use that makes the file unreadable. A lot of the data I have in the csv I don't want readily available to anyone that has a text editor. If the answer is encryption then so be it, I was just hoping that there was a quick easy of change my encoder.

Thanks.

JimmyMac
  • 1
  • 3
  • 4
    The extension a file has (.dat or .txt) does not necessarily have anything to do with its content. The fact that when you open your .dat file numbers are unreadable is not because of the file itself but how you open it (What program and what encoding). If you want to encrypt your file content to not be human readable you have to write encrypted data in that file. Simply adding an extension to the filename will not have any effect on the actual file content. – OH GOD SPIDERS Oct 05 '20 at 13:14
  • Germans developed Enigma for unbreakable purpose, maybe you could use it and enhanced not to be cracked by others. – Traian GEICU Oct 05 '20 at 13:19
  • I assume you want to protect against changing the file, too? Check https://stackoverflow.com/questions/3698572/java-possibilities-to-protect-files-against-manipulation for more ideas. Encryption might be a solution but then you would have to think about where to store the encryption keys. – lugiorgi Oct 05 '20 at 13:23
  • 1
    Note that just because *you* can't find meaning from binary data doesn't mean that it's entirely unreadable. Given the right tools and skills, most binary formats can be reverse engineered. – Joachim Sauer Oct 05 '20 at 13:52
  • Thanks to all for replying. It's not that the data is sacred, it's just I liked it when I saw that UTF-8 made my integers squares. I thought it would be nice to see if there was an encoder that did the same with text. Potentially I'll just convert each word into an array of chars then output that and see what it'll do. Thanks. – JimmyMac Oct 05 '20 at 22:07

0 Answers0