Comparison improvement: Synchronized scrolling and difference highlighting

Wishlists for new functionality and features.
Post Reply
rainwarrior
Posts: 3
Joined: 28 Jul 2018 19:01

Comparison improvement: Synchronized scrolling and difference highlighting

Post by rainwarrior » 28 Jul 2018 19:17

Have been trying out HxD recently, and I think it's a really fantastic hex editor.

However, the comparison feature does not seem useful at all in its current form. Binary comparison is a task I do frequently and it would be great to have it integrated with a hex editor like this. I think it's very close to being extremely useful though, with only the following addition:

1. When using comparison, highlight all differing bytes in view with some colour change.

2. Skipping to next/previous should go to the next contiguous group of changed bytes, not the next byte.

Without 1 this really can't be used to quickly visually inspect differences, and without 2 scanning for the next group of differences one takes too many presses of F6 to ever get there (imagine a 1000 byte string of changed data).

I usually use a tool called VBinDiff for that task but having a comparison feature like this in a good windowed hex editor like this would be a much better replacement.


Edit: Realized F6 does the recentering for both compared files, but really when comparing groups you need to be able to move around in lock step to look, so there's maybe a little more to it:

3. scrolling or using the cursor keys should scroll both panes at the same time (and probably a coloured highlight of the currently selected byte in both panels so you can see where you are).

Maël
Site Admin
Posts: 945
Joined: 12 Mar 2005 14:15

Re: Comparison improvement

Post by Maël » 30 Jul 2018 02:23

So your feature request can be summarized to:
  • Highlight differing bytes
  • Synchronized scrolling of both windows
    • scrolling or using the cursor keys should scroll both windows at the same time

rainwarrior
Posts: 3
Joined: 28 Jul 2018 19:01

Re: Comparison improvement: Synchronized scrolling and difference highlighting

Post by rainwarrior » 30 Jul 2018 06:58

Yes, though there was one more: ability to advance to the next group of different bytes rather than the next byte.

Maël
Site Admin
Posts: 945
Joined: 12 Mar 2005 14:15

Re: Comparison improvement: Synchronized scrolling and difference highlighting

Post by Maël » 30 Jul 2018 18:30

The next group of bytes means what exactly? The next difference (= inserted, deleted or changed blocks)?

I haven't seen that VBinDiff does it, but there are other tools that support resynchronizing compares. That's a lot more complex than byte wise compare, though. (NP complete problem, so you need heuristics.)

rainwarrior
Posts: 3
Joined: 28 Jul 2018 19:01

Re: Comparison improvement: Synchronized scrolling and difference highlighting

Post by rainwarrior » 30 Jul 2018 19:22

Contiguous groups. If there are 100 different bytes in a row that are different, that's one group. I don't want to hit F6 100 times in a row and then finally on the 100th time have it jump across the file to the next difference, I want to get to that next difference in one step.

Yes, there's a lot of complicated stuff that diff/merge tools can do, but I was making this request because it seemed like it could have a lot more utility with hopefully relatively small feature additions.


Actually I notice that in its current form, it can be used to compare things that don't start at the same file offset, i.e. you can set the current cursor position at two different locations in the different files before pressing F6. That's maybe a useful thing, being able to manually set the starting point for the comparison. Kind of at odds with the other requested thing, i.e. synchronized scrolling. You'd have to be able to turn it off for that. ...anyway that's just an aside. Obviously there's a huge rabbit hole of diff tool stuff, I wasn't trying to request that HxD become the perfect diff tool. In my own use the side by side comparison aligned to the beginning of the file is by far the most important case, but probably everyone has different needs.

Maël
Site Admin
Posts: 945
Joined: 12 Mar 2005 14:15

Re: Comparison improvement: Synchronized scrolling and difference highlighting

Post by Maël » 31 Jul 2018 00:43

Ok, so once a byte pair that is different is found, skip over all the differences that follow immediately. If there is a new contiguous block of differences, jump to it.

In this case, you would really need to have colored/highlighted blocks to understand what you are doing/goes on, and maybe some additional info in the status bar, such as the sizes/positions of the differing blocks.

That would mean looking ahead further down the file.

vertigo
Posts: 5
Joined: 08 May 2018 19:42

Re: Comparison improvement: Synchronized scrolling and difference highlighting

Post by vertigo » 17 Sep 2018 09:58

I agree 100% with this, and have been meaning to post something similar for a while. I also often do file comparisons and, as much as I love HxD, I prefer to use WinMerge whenever possible due to how it works in comparison. Unfortunately, it crashes when trying to compare files larger than ~100MB. But if I take two very similar files, say two mkv (video) files with the same content, where only the headers differ, it's near impossible to see this with HxD, since I have to press F6 and hold it forever to get through the differing content before I finally get to the identical data. Also, whenever I do this, once I get to the identical data and it sits there scanning the rest of the file, when it gets to the end it gives me a stream read error. In contrast, comparing the files in WinMerge highlights the differences, both in the raw data and in an overview bar to the side, so I can tell at a glance that the only differences are at the very beginning and the rest of the file is identical. That is immensely more useful. Another neat feature in WinMerge is the ability to create line filters, so you can tell it to ignore lines that differ if they contain certain characters/words/etc.

Another thought on this is that it would be nice if it were smart enough to recognize that even though the files are different when comparing each bit to the same number bit of the other file, they are identical between certain points when staggered. For example:

File 1: 123457890ABCDEFG
File 2: 1234567890ABCDEFG

Unless I'm mistaken, doing a comparison and hitting F6 repeatedly would go through all of that and see it all as being different, but in reality the only difference is bit 6 not being in file one, and everything after that point is identical in both. I know this would likely be very complicated, but it would be nice.

Post Reply