Warum heißen Hex-Editoren binäre Editoren?

15992
Joseph A.

Hex und Binär sind zwei verschiedene Basen. Hex ist meines Erachtens einfach eine einfachere und bequemere Version von Binary.

Ich höre jedoch oft, dass Hex-Editoren binäre Editoren sind. Wenn Sie bei Google nach "Binär-Editor" suchen, erhalten Sie Hex-Editoren.

80
Hex ist eine etwas lesbare Darstellung von Binärdaten. Salman A vor 8 Jahren 2

12 Antworten auf die Frage

184
Steven

A binary editor edits a file as a binary file.

Binary file - Wikipedia

A binary file is a computer file that is not a text file. The term "binary file" is often used as a term meaning "non-text file" [and is] usually thought of as being a sequence of bytes. ... Binary files typically contain bytes that are intended to be interpreted as something other than text characters.

A hex editor is a type of binary editor in which the data is represented in hexadecimal.

Hex editor - Wikipedia

A hex editor (or binary file editor or byte editor) is a type of computer program that allows for manipulation of the fundamental binary data that constitutes a computer file. The name 'hex' comes from 'hexadecimal': a standard representation for numbers that has 16 as its base.

84
Lightness Races in Orbit

Terminology is hard. Different people have all sorts of different names for things.

In this instance, it appears that the hex in "hex editor" refers to the conventional human-readable representation of each byte's value, whereas the binary in "binary editor" refers to the notion that you're indeed editing the file at the byte layer (and computers store bytes in binary), without consideration for higher-level text encoding and the like. Recall that files not readily representable in higher-level text form are called "binary files" or "binaries", for the same reason.

Neither is technically incorrect; they just come at the naming problem from different angles. On a personal note, though, I would tend to agree that "binary editor" is confusing on balance.

55
Margaret Bloom

Binary editor display (in binary)

00000000 | 11111011 11111011 11111011 11111011 11110101 11111011 11111011 11111011 00001000 | 11111011 11111011 11111011 11111011 11111011 11111011 11111011 11111011 00010000 | 11111011 11111011 11111011 11111011 11111011 11111011 11111011 11111011 00011000 | 11110101 11111011 11111011 11111011 11111011 11111011 11111011 11111011 00100000 | 11111011 11111011 11111011 11111011 11111011 11111011 11111011 11111011 00101000 | 11111011 11111011 11101111 11111011 11111011 11111011 11111011 11111011 00110000 | 11111011 11111011 11111011 11111011 11111011 11111011 11111011 11111011 00111000 | 11111011 11111011 11111011 11101111 11111011 11111011 11111011 11111011 01000000 | 11111011 11111011 11111011 11111011 11111011 11111011 11111011 11111011 01001000 | 11111011 11111011 11111011 11111011 11111011 11111011 11111011 11111011 01010000 | 11101111 11111011 11111011 11111011 11111011 11111011 11111011 11111011 01011000 | 11101111 11111011 11111011 11111011 11111011 11111011 11111011 11111011 01100000 | 11111011 11111011 11111011 11111011 11111011 11101111 11111011 11111011 01101000 | 11111011 11111011 11111011 11111011 11111011 11111011 11111011 11111011 

Binary editor display (in hexadecimal)

00 | fb fb fb fb f5 fb fb fb fb fb fb fb fb fb fb fb 10 | fb fb fb fb fb fb fb fb f5 fb fb fb fb fb fb fb 20 | fb fb fb fb fb fb fb fb fb fb ef fb fb fb fb fb 30 | fb fb fb fb fb fb fb fb fb fb fb ef fb fb fb fb 40 | fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb 50 | ef fb fb fb fb fb fb fb ef fb fb fb fb fb fb fb 60 | fb fb fb fb fb ef fb fb fb fb fb fb fb fb fb fb 

It is true that a binary editor should let you handle bytes in binary, but as you can see the base 2 is too small to give compact numerals.

Binary as raw, not base two

Generally speaking, then "binary" in binary editor doesn't refer to the base two, it actually is the antonym of "text editor".
The difference being that text editors are designed to show text, so non printing characters, new lines, control chars, invalid utf-8 code units and so on are not required to be handled safely.
The mere act of opening a file and immediately saving it can change it (due to the editor internal conversions, failures).

Binary editors on the other way, don't try to give the data any semantic and let the user safely handle it as a stream of bytes/bits/words.

Hexadecimal editors

The perfect binary editor would known every possible binary format and let you edit it, but since everyone can make its own binary format and since they change very often, it is futile to try to support all formats.
The best thing an editor could do is showing the bytes themselves, and due to the, already discussed, properties of base 16, hexadecimal numerals are very handy!

Also an experienced user can mentally translate bin to hex as they read it.
Setting/getting a bit out of a byte written in hex takes really absolutely no more effort than a byte written in bin.
To be honest I found hex easier than binary to read.

Schöne Beispiele, die den Unterschied zeigen. Wenn man sie nebeneinander sieht, sieht der Hex viel schöner aus DrZoo vor 8 Jahren 1
@DrZoo Wenn Sie es nicht mit Bitfeldern zu tun haben, ist die binäre Darstellung in diesem Fall viel schöner! https://en.wikipedia.org/wiki/Bit_field. misha256 vor 8 Jahren 1
misha256: ehrlich gesagt, wenn ich mir hex anschaue - ich sehe binär. Ich lese "f", aber mein Gehirn sagt sofort "1111". Es ist wie das Betrachten der Matrix in kompakter Form. :) tdrury vor 8 Jahren 6
+1 für die Betonung "Binär als Rohmaterial, nicht Basis zwei" Kelvin vor 8 Jahren 4
@thrury guter Punkt, ich nehme an, nach einer Weile fangen Sie einfach an zu "sehen", was Sie sehen müssen, unabhängig davon, wie es ausgedrückt wird. Haha, ja, Matrix! Erinnert mich an einen Typen, mit dem ich zur Schule gegangen bin, der die Maschinensprache glücklich in Hex oder Dezimalzahl codierte und zwischen den beiden frei konvertieren konnte. Er kannte alle Op-Codes auswendig und sah Bitfelder und andere gepackte Datenstrukturen wie seine Muttersprache. Das waren die Commodore 64 Tage wohl (weitaus einfachere Tage), aber immer noch ein beeindruckendes Talent. misha256 vor 8 Jahren 5
Ich stimme nicht zu, dass die Division so sauber fällt. Ein Hex-Editor * ist * ein Binär-Editor, denn Binär bedeutet nicht nur die Basis, in der er visuell dargestellt wird, sondern was hinter den Kulissen geändert oder gelesen wird. Ich denke, Ihre Antwort wäre genauer, wenn Sie die beiden Blöcke als "Binäreditoranzeige (in Binär)" und "Binäreditoranzeige (in hexadezimal)" bezeichnen. ErikE vor 8 Jahren 0
@ErikE True. Ich benutze deine Etiketten, wenn es dir nichts ausmacht. Margaret Bloom vor 8 Jahren 0
Bravo! Es fällt mir auch ein, dass die oberste eine Hexadresse auf der linken Seite haben könnte. Und dass beide natürlich eine Textdatei anzeigen und bearbeiten könnten ... ErikE vor 8 Jahren 0
14
DavidPostill

Why are hex editors called binary editors?

Summary:

A Hex Editor is used to directly edit a binary file by displaying the binary content in hexadecimal format and allowing these hexadecimal numbers to be changed.

Notes:

  • Hex Editors allows editing of the raw data contents of a file, instead of other programs which attempt to interpret the data.

  • Hex Editors as also called Binary Editors or Byte Editors.

  • Calling them Binary Editors or Byte Editors is not really correct as the editors are changing hexadecimal numbers and not binary numbers or bytes (of course the underlying binary numbers and bytes will change if the file is saved)

Why do we edit binary use hexadecimal?

It is easier to directly view or edit/modify binary files by displaying the data in hexadecimal form and changing the hexadecimal values.

  • One convenient way of representing binary numbers is using hexadecimal.

  • Historically computers were programmed in assembly language, where code was written using processor instructions and meta-statements (known variously as directives, pseudo-instructions and pseudo-ops), comments and data.

    • The code is translated into binary using an assembler. The binary code can then be loaded into a process and executed.

    • Without the source code it is easier to modify the program directly using an editor that displays the program in hexadecimal rather than binary.

  • Binary code is more easily readable by humans when converted into hexadecimal.

    For example, which pair of number is easier to memorise or read out to someone else?

    10110000 01100001 

    Or

    B0 61 
  • Each hexadecimal digit represents four binary digits (bits). One hexadecimal digit represents a nibble, which is half of an octet or byte (8 bits).

    For example, byte values can range from 0 to 255 (decimal), but may be more conveniently represented as two hexadecimal digits in the range 00 to FF.

  • Hexadecimal is also commonly used to represent computer memory addresses.

Beachten Sie auch, dass Base 64 zwar noch einfacher zu speichern scheint, aber wir halten uns an Hex, da es die nette Eigenschaft hat, 2 Zeichen ⇒ 1 Byte abzubilden. PythonNut vor 8 Jahren 3
8
jlliagre

According to several programming language and operating system conventions, there are two kinds of files:

  • text files which are made of a suite of text lines, each line being composed of a suite of printable characters (including some control characters) and terminated by end of lines
  • binary files that contain an arbitrary suite of bytes including the null byte which is forbidden in a text file.

Text editors are able to open text files while binary editors have no restrictions on the kind of files they process.

The fact binary editors often represent and allows entering data in hexadecimal is just a convenience (they often display and allow replacing ascii characters too), only displaying data in pure binary would make the data less legible.

A popular binary editor is named HexEdit.

enter image description here

It rightly considers itself both a binary editor and an hex editor:

enter image description here

There is even an option not to display the data in hex but only the text

enter image description here

5
infixed

When people are using hex, they are usually thinking in binary and using the hex as a shorthand notation.

Sixteen is a power of 2. Eight is also a power of two. So 16 and 8 have been used for shorthand notation of binary. Manual conversion between binary, and a base of some power of two is easy. Just group the bits together in the size indicated by the target base, and then use the corresponding digit.

Base 8, octal, was popular for many early computers, which is why Unix has an od octal dump command. Each octal digit represents 3 bits at a time. But it was inconvenient for machines based on 8 bit bytes.

Hexadecimal, hex for short, base 16, represents 4 bits per digit. This is much a more commonly used representation these days.

5
LawrenceC

Files on the great majority, if all, of computers today are 8-bit bytes. That's typically the abstraction one is working with when directly editing a file.

Of course, there is occasion to actually edit individual bits of data, but not often. Common bit-level operations like setting bit 7 are easy to do with hex anyway - 1000 0000base2 = 80base16, so if a hex value is under 80base2 bit 7 is clear and adding 8base16 will set it.

Other reasons why hex is more strongly associated to this type of activity:

  • Hex values are easier to recognize when visually scanning for known values. For example, 20base16 = 32 which is an ASCII space, but the same value 0010 0000base2 isn't so easy to recognize as such among a flood of other dumped values.

  • Old systems where you actually needed to use this on a regular basis may have had limited screen space (e.g. 40 columns). The Apple IIe ROM monitor is a great example, it can dump memory in hex to the 40-column integrated video, and expanding values to binary on an 80x24 screen will run you out of room quickly. For these old systems, it's also easier to write routines to convert inputted ASCII back to the right values. Important where 4K of RAM was considered a lot of memory and systems may have only had as much ROM.

  • The word "hex" sounds better, is shorter, and is easier to type.

3
Burgi

This refers to how computers store information.

On the basic level computers use 0 and 1 to represent data, these are called bits. Eight bits grouped together is a byte. Hexadecimal is base 16 which means it has 16 characters (0-9, A-F). To store a character it takes 8 bits or 1 byte.

So a hexadecimal number 13 (19 in decimal) is the same as 0001 0011 in binary. It is easier to read hex than it is binary.

2
AnrDaemon

Die ersten binären Editoren, die ich kenne, waren auch Disassembler. Das heißt, die Bearbeitungsfunktion war ein Nebenprodukt beim Zerlegen und Patchen einer ausführbaren Binärdatei.

Ein gutes Beispiel für eine solche Anwendung ist Hiew.

Zusammengebauter Code (Assembler-Anweisungen) wird häufig als Hexadezimalzeichenfolgen dargestellt. Ich denke, hier entsteht moderne Verwirrung. Die Leute wissen einfach nicht, mit was sie zu tun haben.

2
Mike Gillis

Any compiled, runnable file (like somefile.exe, for example, on Windows) is sometimes called a "binary", since it's been compiled into machine-level code which is correct on the binary level to be executed by the processor directly.

So you're editing a binary. It just happens to be displayed in hex because hex is useful for humans.

Ja, aber viele Dateien sind auch binär. Sie sparen Platz und Übersetzung, wenn sie von der entsprechenden Anwendung gelesen werden. Sogar Textdateien werden häufig verschlüsselt oder komprimiert, wodurch sie zu Binärdateien werden. Joe vor 8 Jahren 0