Looking for a program to compare hex files(like Diff Merge, etc.)

Started by curseofnight86, August 07, 2019, 12:20:33 PM

Previous topic - Next topic

curseofnight86

Hello. I have a problem and since so many people here know a thing or two about hex editing, it seemed a good place to ask...

I'm trying to compare two sets of hex code copied from the same file type to see which lines are different. (In this case there is only 1 thing that is different between the files)

The problem I'm having is that when I copy and paste the hex code into Diff Merge or similar programs it pastes as one single line. So what I'm looking for is a program that will automatically create line returns every X amount of characters. I want it to automatically format the same way it is in the hex editor, basically.

Each set of hex code is about 5mbs of text so a second requirement is a program that can handle 10-12mbs of raw text at once.(since I'm comparing two files...) I only mention this because Diff Merge crashes consistently with large text files.

I don't care what kind of program it is, 32bit, 64bit, a text editor, etc. As long as it can automatically set line returns at user specified intervals.

So, does anyone have any ideas?

Edit: A user on the UltraEdit forums informed me that UltraEdit could do this through a script and was even kind enough to provide one for me. However, I haven't tested it yet and UltraEdit isn't free and only has a 30 day trial so I'm still interested in other options - preferably freeware.

Does EMACS support a scripting system? I just thought of EMACS like 10 seconds ago as I was typing, lol. Hmmm, gotta look into that....

FAST6191

Is this an in place compare or a relocating one (e.g. you added a word somewhere and shuffled everything beyond it forward by that much).
Most compare programs/functions only do in place, though some will attempt to locate where the new data at least got moved on to. I quite liked hex workshop's compare feature, as it also does what it calls a resyncronizing compare ( http://www.hexworkshop.com/onlinehelp/600/html/idhelp_compare_resynchronizing.htm ).
Hex workshop is paid software but good. For most purposes with a bit of fiddling I found paid hex editor functions can be replicated with a collection of free ones -- I usually suggested XVI32, mirkes.de tiny hexer, hxd because why not and icy hex editor and https://sourceforge.net/projects/hexplorer/ with tiny hexer probably being what you want to look at here.

As far automatically set line length then that sounds like word wrap needs to be clicked in a text editor. I don't know how that will play out with something like notepad++'s column select/column editing ( https://notepad-plus-plus.org/features/column-mode-editing.html ) offhand but might be worth a go.

curseofnight86

Thank you for your reply, FAST6191, :)

It's in place compare.

I just downloaded the latest version of notepad++ and played around with it. It doesn't really work the way I need it to.

I'm probably gonna buy UltraEdit actually, as it does exactly what I need(without using the aforementioned script, btw) and comes with UltraCompare for free. It also has a ton of neat coding features.

I'm definitely not paying for a hex editor though, lol. The reason I want to compare the hex code in this way is because I don't actually care to learn it really. I mean I do but it's time consuming and hard for me. I'm already trying to teach myself C++ and little C also so I've picked up a tiny bit from books and vids about dealing with pointers in memory but I only care to learn the bare minimum for coding I suppose.

Anyway, I'll take a look at the freebies you mentioned and see what features they offer, thanks for that.

FAST6191

What is there to learn about hex(adecimal)? It is a way of counting but rather than go between 0 and 9 then you go between 0 and F (A through F happening after 9). It is commonly used to represent binary as it is able to represent 4 binary bits in one character with nothing missing and nothing left over.

Everything else is situational.

abw

Another option is to convert the hex to text and use your favourite text editing/comparison tools. If you have access to unix tools, `xxd` is very useful for getting a hex dump of a file (be sure to read through the formatting options if you don't like the default output), or if your hex editor has table support, you can make a simple hex-to-text table like
Quote
00=00
01=01
...
FF=FF
dump the entire file, and then insert line breaks wherever you like.

Ansarya

FlexHEX is free for home users and has a lot of good features. It can be a little complex sometimes, but a basic comparison isn't hard. Just make sure nothing else has those files open, even FlexHEX. Open one file, then go to compare and pick the second one.

Here's the help page for the comparison feature:
http://www.flexhex.com/docs/help/search/compare.phtml

And you can find the download link from there.

curseofnight86

Quote from: abw on August 08, 2019, 08:52:55 PM
Another option is to convert the hex to text and use your favourite text editing/comparison tools...

This is the option I decided to go with(UltraEdit/UltraCompare). So far it's working nicely.

@Ansarya: I just downloaded FlexHEX. I'll check it out this evening. :)

Chronosplit

Quote from: Ansarya on August 08, 2019, 09:15:01 PM
FlexHEX is free for home users and has a lot of good features. It can be a little complex sometimes, but a basic comparison isn't hard. Just make sure nothing else has those files open, even FlexHEX. Open one file, then go to compare and pick the second one.

Here's the help page for the comparison feature:
http://www.flexhex.com/docs/help/search/compare.phtml

And you can find the download link from there.
Just wanted to say thanks for this one.  It looks like just what I needed for my next task!

filler

Quote from: curseofnight86 on August 09, 2019, 09:18:15 AM
This is the option I decided to go with(UltraEdit/UltraCompare). So far it's working nicely.

@Ansarya: I just downloaded FlexHEX. I'll check it out this evening. :)

FWIW I've used UltraEdit/UltraCompare for my (web) development work for years and they've done what I need. Also handy for translation work,  though I still use a separate hex editor.

Ok Impala!

Quote from: Chronosplit on August 10, 2019, 06:15:32 PM
Just wanted to say thanks for this one.  It looks like just what I needed for my next task!

A thank you from me too. FlexHex just helped me solve a problem in my hack with it's great comparison feature!  :)

MysticLord

I haven't used this in years, but here's a crappy little Java script, if you should be so unfortunate as to have Java installed. Think it needs JDK 8 or greater.

https://pastebin.com/CMDdGHg8

Compilation:

javac JDiff


Don't remember the usage, think it's

java JDiff file1.bin file2.bin > output.txt


Might need to replace JDiff with the *.class output of the compiler.

Voltaire99

For quick stuff I just use HxD with the hex plugin

This program is a bit better than HxD's plugin:
https://pcwin.com/Software_Development/HexCmp/index.htm

Hex Workshop has a more advanced way of doing it, might be what you're looking for
http://www.hexworkshop.com/onlinehelp/600/html/idhelp_compare_resynchronizing.htm