-1

I want to create my own binary file.

When I've opened a .3ds file, at the beginning I've found :

MM����
������==���>=
�����������������Standard_1������   ������ �����    ������0�����    ������@����0����
�A����0������P����0������R����0������S����0�����������������0�������������
������?��3���0����d������LUMBERJA.PNG�Q������S�

These letters are unreadable. I would like to make my own file which no one can read.

I want to make this in Java on Android. Note that I don't want to use Cypher.

cygri
  • 9,412
  • 1
  • 25
  • 47
  • 2
    you probably mean not `compiled`, but `binary` file – Vladyslav Matviienko Apr 18 '19 at 11:42
  • Your talking about *binary files* - i.e. files that store non-textual data. If you understand the format then they are perfectly readable in code so if your intention is data protection your on the wrong track. – Alex K. Apr 18 '19 at 11:43
  • @AlexK. Thanks but how can I create this by Java? Can you give me reference? – Ashraful Alam Shakil Apr 18 '19 at 12:24
  • 2
    That depends on what it is you want to save as binary data. One general approach would be serialization https://stackoverflow.com/questions/4118751/how-do-i-serialize-an-object-and-save-it-to-a-file-in-android – Alex K. Apr 18 '19 at 12:27
  • Welcome to StackOverflow! I've edited your question to reflect what we've learned in the comments. This should help others understand what you're asking. – cygri Apr 18 '19 at 20:43

1 Answers1

0

Those letters are not unreadable.

Let's say you don't speak french. At all.

That doesn't make french text 'unreadable'... it is merely unreadable to you. It is perfectly readable to just about everybody who lives in France, for starters.

Your example is no different. It may not be readable to you, but anybody who knows the file format can write software that can read this data.

Making software that can read something, in a way that no other software can be written that can read it, is also impossible: Your software runs on a device you do not control. The owner of that device can sandbox your application and figure out the format. even if you try to encrypt the data, that won't work: The owner of the device can use tools to extract the key from your software.

If you want truly 'unreadable' data, either [A] have that data in a location where you can control who gets to read it (example: Host files on a server, not in the application), or [B] encrypt the data and have the user provide the key information for it (for example, a password).

If your aim is merely to be able to produce a binary file.. java's OutputStream can do that. Write whatever bytes you like.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
rzwitserloot
  • 85,357
  • 5
  • 51
  • 72
  • Thanks. I was wrong about that thing. Now, I want to create a file like this. But, searching on internet about converting text to binary file gives me examples of transforming to binary like 0001 0100. But, I want to get the file as I've given an example above (like .3ds). Can you give me any reference or answer it again with an example? – Ashraful Alam Shakil Apr 18 '19 at 12:23