S
S
Stanislaw112015-09-27 00:22:17
Programming
Stanislaw11, 2015-09-27 00:22:17

Where can I read about binary data and hex dumps?

Hello. I'm interested in working with the contents of binary files. I know there are hex editors, but they dump hexadecimal files. Where can you read about them? How to understand which byte means what? And how to create such files yourself?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Valery Ryaboshapko, 2015-09-27
@Stanislaw11

The question is extremely general. Start by learning the very basics, how information is presented, and number systems.
In general, if we talk about integers, then there is no difference between numbers written in binary, decimal, hexadecimal and sexagesimal number systems. Specifically, the hexadecimal system in the computer world is popular because it allows you to use a number of characters to write a number that is a multiple of the number of characters in binary notation. Such a compromise between brevity and clarity. For example, to write one byte, you can use 8 binary characters, four octal characters, three decimal characters (with only three options in the high order), or two hexadecimal characters.
In a broad sense, any file is binary, as it is written on the media using only two possible characters. In a narrower sense, binary files are the opposite of text files. But in any case, the choice remains very large: application executable files, music, video, images, archives, many documents, databases, etc.
To understand the meaning of specific bytes, you need to know the context, the file type. In the case of a data file, their meaning is described in the storage format specification. In the case of an executable file, everything is a little more complicated, because the von Neumann architecture implies the storage of both executable commands and data in shared memory. Thus, it is rather difficult to unambiguously determine which byte is a command to the processor, and which data is, for this you need to know the format of the executable files of a particular operating system, use this format to find the first byte that will be executed by the processor, and look through all the bytes in turn, follow behind the progress. In the simplest case, commands are executed one after another, but conditional jumps are possible. They are all tracked and thus separate data from commands. Usually this is not done manually, and with the help of special disassembler programs, which at the output give a program written in assembly language, in which one instruction corresponds to one processor operation. From this code, it is relatively easy to understand what the program is doing.
Manually creating binary files is an extremely rare situation these days. With data files, this is already obvious (there are editors for every taste and color). With executables, this is also rare, as there are high-level programming languages ​​that are similar to human language and are translated into binaries by compilers. Only in a number of special cases is written in the same assembler, which is very close to machine codes and allows the programmer to almost unambiguously determine the contents of the final executable file.
And to find out which assembler instruction corresponds to which machine code, you need to read the specification of a particular processor architecture.

G
GDApsy, 2015-09-27
@GDApsy

Any file is a sequence of zeros and ones in the end, although it is convenient at a more application level to separate the so-called text files (ASCII and Unicode) and binary ones, that is, something that is not plain text. On the other hand, you need to read about the units of measurement of information, number systems based on 2, 8, 16, and in addition, understand the essence of those programs and formats that create a particular file. And there is simply no universal reading that will explain the meaning of any file in the world.

S
Saboteur, 2015-09-27
@saboteur_kiev

Binary data is anything that is not plain text (that is, plain text).
Pictures, videos, archives, programs are all binary data.
The essence of binary data is that they need to be viewed by special programs that understand this format. Therefore, for example, Word cannot open an mp3 file - it knows the format of other files, not sounds.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question