Hex editor

from Wikipedia, the free encyclopedia
View an EXE ( Portable Executable ) file in a hex editor
View of a text file created with gedit in a hex editor
Hex code of the Stoned virus in the hex editor

A hex editor (also hex editor ) is a computer program with which the bytes of any files can be displayed and edited as a sequence of hexadecimal numbers . If the editing option is missing, one speaks of a hex viewer or hex viewer . Both variants are particularly useful for viewing and editing binary files .

General

All types of files can be viewed with a hex editor, whereby the data is not interpreted as standard. Image files , MP3 files and executable files are represented as a sequence of bytes without these being interpreted as colors, sounds or computer commands.

The representation of a hex editor can be quite confusing. This is why there is often the option to display data in an interpreted and structured manner and to choose between different interpretations and displays.

Advantages of hex editors

Programs usually require that data correspond to a certain structure or format; therefore they cannot do anything with the data if the structure is damaged. The ability of hex editors to edit data at the lowest level enables, for example

  • read and restore structurally damaged data,
  • analyze the structure of a file format or
  • Editing areas that are usually not accessible or editable by the user, such as meta information in images or text documents or the states of a game figure in games.

Usual representation of a file by a hex editor

00000 48 61 6C 6C 6F 2C 20 64 69 65 73 20 69 73 74 20 Hallo, dies ist
00010 65 69 6E 20 42 65 69 73 70 69 65 6C 2D 54 65 78 ein Beispiel-Tex
00020 74 2E                                           t.

Hex editors are usually structured as follows (explanation based on the example shown above):

  • An offset is displayed on the far left . This indicates the number of previous bytes in hexadecimal notation. In the first line the offset is 0, which corresponds to the beginning of the file; in the second line it is 10 16 , i.e. i.e., 10 16 = 16 10 bytes preceded it. Some hex editors also show offset, cluster and sector numbers in decimal (the latter two are important for editing data at the file system level ).
  • In the middle, the bytes (more precisely octets ) of the file are shown in hexadecimal format, e.g. B. 48 16 for the first byte in the first line.
  • Finally, on the far right, the bytes of the current line are shown as text (in a specific character set ). In the example, the bytes are interpreted as ASCII , the most common 1-byte code (the first byte 48 16 corresponds to the letter H ). This representation can only be used if the data is actually text. So z. For example, images appear as random strings of characters, but sometimes patterns can be seen (especially in uncompressed images such as bitmaps ).

Disk editors

With some hex editors you can not only edit files, but also the underlying data blocks of data carriers (such as floppy disks or hard drives). Programs that offer this as a primary function are usually, disk editor or Disk Monitor called, in which case almost always the function of the processing is given (and not just the viewing).

Web links