lfhex - manual

salem | 2005-08-07 02:52





Compiling

For most *nix systems, all that should be required is:

  • Qt 4.x
  • a sane compiler with respect to templates (g++ works)
  • flex and bison (apt-get install flex bison)

lfhex uses "qmake" for builds. The following commands should work for most *nix systems.

% cd src
% qmake
% make
% make install




Running

lfhex supports basic X11 command line options supported through Qt's
QApplication class. Here are some options I find useful:

-fg           
Set foreground color.

-bg           
Set background color.

A full list of supported X11 options can be found in the Qt documentation
for the QApplication class
.

The command line option "-c" is used to start lfhex in "compare" mode.

All other arguments on the command line are assumed to be files you
wish to view/edit. These files are loaded on startup into separate lfhex
gui's (within the same process). lfhex loads blocks of files "on demand"
to reduce memory requirements. Loading a 2gig file will only take 1.4-1.6
meg of memory, and very little address space.

When saving files, only differences are written. When choosing to "Save
As...", the whole file must first be copied, and therefore "Save As..."
times can be lengthy.




Viewing/Editing

lfhex can view files over 4gigs in size (if the OS supports large file offsets). Using a paged i/o abstraction file open times are invariant with file size, a 2gig file opens just as fast as a 2k file. Navigation through the file is accomplished using the scrollbar and basic keyboard interface (arrow keys, home, page up, page down, and end). You can also go directly to a specific byte offset by entering the offset (in hex) in the "Current Offset" field. You can also use basic math functions in the "Current Offset" field. You can specify numbers in either hex format (0x...) or base 10. For example if you wanted to go to the 15'th 4 byte word offset you could use the string "0xf*4".

The offset of the first byte is displayed to the left of each line.

lfhex supports infinite (as memory permits) Undo/Redo through the menu:Edit->Undo|Redo.

You can view and edit files in four different modes:

  • ASCII -> data is translated into ASCII character set.
  • Hexadecimal -> data is translated into base 16, each byte is represented
    with 2 hex digits.
  • Octal -> data is translated into base 8, each byte is represented with
    3 octal digits.
  • Binary -> data is translated into base 2, each byte is represented with
    8 binary digits.

The editing mode is configurable at runtime through the pulldown menu:
View->Editing base. The editing base can be changed dynamically and does
not interfere with the undo stack.

By default, lfhex will set the number of bytes per column to 1. You
can choose to view the data using 1, 2, 4 or 8 bytes per column through
the pulldown menu: View->Bytes per column.




Conversion Dialog

The conversion dialog allows you to translate raw bytes into C primitives:
ASCII chars, int, float, and double. Changing the data in any of the conversion
entries will update the values in the rest of the entries. As of v0.2 int,
float, and double entry boxes have the option of byte-swapping the data
before performing conversions. Clicking on the "b/s" toggle button to the
left of an entry will force the conversion dialog to rotate the bytes 
of incoming data before performing conversions. If you are editing an entry
with the "b/s" flag set, the byte-swapped representation of the value you
enter will be used to set the remainder of the dialog's entries.

The conversion dialog is also linked to the mouse selection. When selecting
data in the editing window with the mouse, the conversion dialog is dynamically
updated with the selected data. If the selection is cleared, the default
behavior is to leave the old selection in the conversion dialog. If you
would like a cleared selection to clear the conversion dialog, then you
must uncheck the "Ignore selection clear" check box in the conversion dialog's
"Options..." menu.



Searching

Searching is accomplished through the conversion dialog. Enter the byte
sequence you would like to search for in the conversion dialog. Then press
the "Search" button in the conversion dialog. You can search backwards
and forwards from the current cursor location by toggling the "Search Forwards"
toggle button in the conversion dialog's "Options..." menu.

At this time you cannot search through a file which has unsaved modifications.
This limitation is for performance issues. The search routine is not currently
optimized and is relatively slow. If I receive enough feed back I will
work on the routine. At least 2x improvement should be possible.



Binary Compare Dialog

When invoking lfhex using the "-c" option the GUI comes up with two editors embedded into one top level window. Opening a file in each editor will allow you to search through each file stopping at differences. The buttons in the toolbar can be used to step through each found difference. The "Options" tab allows you to configure the "block" sized used in the comparison (the "X" parameter). It also allows you to specify a fixed offset between files (the "Y" parameter). This is useful if your files are believed to be identical with the exception of different sized headers. For example if your data is a list of integers you would set the X parameter to 4.

Lfhex

Tonality

User login

Navigation

PHP

Kccmp

Java

Homestar

Slashdot


Advertisement