Edit Anything

Professional text and hex editing
with Binary Templates technology.

010 Editor - Text/Hex Editor Homepage

The Compare Files tool allows the binary comparison of two files or two blocks of data for byte-by-byte differences. Note that this comparison is different that most text editors which only compare line-by-line. Access the Compare Files tool by clicking the 'Tools > Compare Files...' menu option.

Compare Dialog

Enter the two files to compare in the File A and File B fields. Each field contains a drop-down list of all open and recent files. Click the browse button beside either field to use a file dialog box to select a file. Note that if exactly two files are open in the main Tab Group in 010 Editor, the file names for those two files will be automatically entered in these fields.

The Comparison tool supports two different algorithms: Binary and Byte by Byte. The Byte by Byte algorithm compares corresponding bytes between the two files (e.g. each byte at address n of file A is compared only against the byte at address n of file B) and will usually run quickly. The Binary algorithm tries to identify blocks within the files that match. This algorithm is fast when the number of differences is low between the files, but slows down if a number of differences exist (the algorithm is O(d2) where d is the number of differences). Select which algorithm to use in the Comparison Type box.

Two options exist for running comparisons in the Options box. If the Match Case toggle is enabled, then ASCII strings must match exactly, otherwise strings with a mixture of upper and lowercase letters will match. If the Enable Synchronized Scrolling toggle is enabled then after the comparison, scrolling one of the files will cause the other file to scroll as well. Synchronized scrolling can be turned off using the 'Window > Synchronize Scrolling' menu option (see the Window Menu for more information).

Other advanced options can be viewed by clicking the Advanced Options button. The display of the files after the comparison is determined by the Display Files box. If the Tile Horizontal toggle is set, the two files will be stacked one on top of the other. If the Tile Vertically toggle is selected, the files will be stacked side-by-side. The files will not be moved if the Do Not Tile toggle is selected.

For the Binary algorithm, a limit can be put on the number of bytes the algorithm searches forward by entering a value in the Max Look-a-head field. The higher the value, the slower the algorithm may run. The Min Match Length field indicates the minimum number of consecutive bytes that must match to display a match in the final output. For higher values, random data is less likely to match, but for lower values, small matches might be ignored. The algorithm contains a heuristic that allows it to quickly accept matches of a certain size. Enter a valid in the Quick Match field to indicate the minimum number of bytes that must match for the heuristic. The lower the value, the faster the algorithm will run but the results may be less accurate.

Click the Compare button to run the algorithm and display the results in the Output Window. The Cancel button will dismiss the dialog when pressed.

Comparing Blocks of Data

The binary comparison tool can also compare two blocks of data in two different files, or two blocks of data in the same file. Blocks to compare are specified in the Limit Comparison box. To compare only part of file A, click the File A toggle and enter the starting address of the block and number of bytes in the block in the Start and Size fields respectively. If the set of bytes to compare has been selected in the file, click the Get Selection icon to copy the start and size of the current selection into the proper fields. If the File A toggle is disabled, then the comparison will use the entire file A. Similarly, to limit the bytes compared in file B, enable the File B toggle and enter values in the Start and Size fields.

To compare two blocks of data in the same file, set the file name for File A and File B to be the same file name. Then specify which blocks of data to compare in the Limit Comparison box. Clicking the Compare button will cause two views of the file to be opened as could be done with the 'Window > Duplicate Window' menu option.

Output Window

The Output Window will appear after a comparison is run. This window displays a list of all matches and differences, plus a graphical representation of how the files match.

The Result field can indicate a Difference, a Match, or may say Only In A or Only In B if a block exists only in one of the two files. Address A and Start A indicate the start and size of the block in the first file, and Address B and Start B indicate the start and size of the block in the second file. Selecting an entry from the list will highlight the block in both files and also highlight the block in the graph. The display format for each column can be set to hexadecimal or decimal by right-clicking on the Output Window and selecting 'Column Display Format'. Data can be sorted in the display by clicking on one of the column headers. For example, to see all the matches and differences grouped together, click on the Result column header.

The graph contains a representation of both files, side by side. Matched areas are shown in gray, differences are shown as red, and blocks that are only in one file are displayed as yellow. When a range is selected, a white box is drawn around the range in the graph. Below the graph is a number indicating the number of ranges in the comparison.

After the comparison is run, the files will be colored according to which bytes match. Bytes that are different will be displayed as light red and bytes that are only in one file will be displayed as light yellow (see Color Options to change the colors). Right-click the Output Window and select 'Clear' to clear the results from the comparison. Press the Esc key in the Output Window to hide the window.

Related Topics:
Color Options
Window Menu

This is the manual for 010 Editor, a professional hex editor and disk editor. Use 010 Editor to edit the individual bytes of any binary file, hard drive, or process on your machine. 010 Editor contains a whole host of powerful analysis and editing tools, plus Binary Templates technology that allows any binary format to be understood.