Hex editor

From Wikipedia, the free encyclopedia
Jump to: navigation, search

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': the standard numerical format for editing binary data. A typical computer file occupies multiple areas on the platter(s) of a disk drive, whose contents are combined to form the file. Hex editors that are designed to parse and edit sector data from the physical segments of floppy or hard disks are sometimes called sector editors or disk editors.

Details[edit]

Screenshot of a common hex editor (hexedit by Pascal Rigaux (Pixel))

With a hex editor, a user can see or edit the raw and exact contents of a file, as opposed to the interpretation of the same content that other, higher level application software may associate with the file format. For example, this could be raw image data, in contrast to the way image editing software would interpret and show the same file.

In most hex editor applications, the data of the computer file is represented as hexadecimal values grouped in 4 groups of 4 bytes, followed by one group of 16 ASCII characters which are derived from each pair of hex values (each byte). Non-printable ASCII characters (e.g., Bell) and characters that would take more than one character space (e.g., tab) are typically represented by a dot (".") in the following ASCII field.

Early history[edit]

Since the invention of computers and their different uses, a variety of file formats has been created. For some, it was convenient to be able to access the data as a series of raw digits. Pairs of hexadecimal digits (each pair can represent a byte) are the current standard, because the vast majority of machines and file formats in use today handle data in units or groups of bytes. Hexadecimal and also octal are common because these digits allow one to see which bits in a byte are set. Today, decimal instead of hexadecimal representation is becoming a popular second option due to the more familiar number base and additional helper tools, such as template systems and data inspectors, that reduce the benefits of the hexadecimal numerical format.[citation needed]

Template systems[edit]

An example of a beginner-friendly hex editor, written in Java. It modifies a program's settings by editing the native bytecode inside the executable file, instead of changing a settings file. This is a fully-fledged hex editor, because it can do any kind of hex editing on any file. Advanced users will need to write a plug-in using the 2012-2013 Mint Programming Language in order to get full control of the editor.

Some hex editors offer a template system that can present the sequence of bytes of a binary file in a structured way, covering part or all of the desired file format. Usually the GUI for a template is a separate tool window next to the main hex editor. Some cheat engine systems consist only of such a template GUI.

Typically, a template is represented as a list of labeled text boxes, such that individual values of a file can be easily edited in the appropriate format (e.g., as string, color, or decimal number). Without template support, it is necessary to find the right offset in a file where the value that is to be changed is stored. Also, raw hex editing may require conversion from hexadecimal to decimal, catering for byte order, or other data type conversion peculiarities.

Templates can be stored as files, thereby exchanged by users, and are often shared publicly over the manufacturer's website. Most if not all hex editors define their own template file format; there is no trend to support a standard or even compatibility between the various formats out in the wild.

Scripting systems[edit]

Advanced hex editors have scripting systems that let the user create macro like functionality as a sequence of user interface commands for automating common tasks. This can be used for providing scripts that automatically patch files (e.g., game cheating, modding, or product fixes provided by community) or to write more complex/intelligent templates.

Scripting languages vary widely, often being product specific languages resembling MS-DOS batch files, to systems that support fully-fledged scripting languages such as Lua or Python.

Plugin systems[edit]

A few select editors have a plugin system that allows to extend the GUI and add new functionality, usually loading dynamic link libraries written in a C-compatible language.

See also[edit]

References[edit]