Ad

How To Create A Binary File?

- 1 answer

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.

Ad

Answer

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.

Ad
source: stackoverflow.com
Ad