News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Looking for a program to compare hex files(like Diff Merge, etc.)  (Read 2530 times)

curseofnight86

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
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....
« Last Edit: August 08, 2019, 08:42:52 am by curseofnight86 »

FAST6191

  • Hero Member
  • *****
  • Posts: 3092
    • View Profile
Re: Looking for a program to compare hex files(like Diff Merge, etc.)
« Reply #1 on: August 08, 2019, 09:27:06 am »
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

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: Looking for a program to compare hex files(like Diff Merge, etc.)
« Reply #2 on: August 08, 2019, 11:35:04 am »
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

  • Hero Member
  • *****
  • Posts: 3092
    • View Profile
Re: Looking for a program to compare hex files(like Diff Merge, etc.)
« Reply #3 on: August 08, 2019, 01:08:15 pm »
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

  • Hero Member
  • *****
  • Posts: 565
    • View Profile
Re: Looking for a program to compare hex files(like Diff Merge, etc.)
« Reply #4 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. 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

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: Looking for a program to compare hex files(like Diff Merge, etc.)
« Reply #5 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.

curseofnight86

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: Looking for a program to compare hex files(like Diff Merge, etc.)
« Reply #6 on: August 09, 2019, 09:18:15 am »
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

  • Hero Member
  • *****
  • Posts: 1522
    • View Profile
Re: Looking for a program to compare hex files(like Diff Merge, etc.)
« Reply #7 on: August 10, 2019, 06:15:32 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

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 980
  • "WINNERS DON'T SELL REPROS"
    • View Profile
    • Filler's Translation Projects
Re: Looking for a program to compare hex files(like Diff Merge, etc.)
« Reply #8 on: August 10, 2019, 07:20:31 pm »
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!

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Ok Impala!
Re: Looking for a program to compare hex files(like Diff Merge, etc.)
« Reply #9 on: March 06, 2021, 10:50:32 am »
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

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: Looking for a program to compare hex files(like Diff Merge, etc.)
« Reply #10 on: March 06, 2021, 03:55:39 pm »
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:
Code: [Select]
javac JDiff

Don't remember the usage, think it's
Code: [Select]
java JDiff file1.bin file2.bin > output.txt

Might need to replace JDiff with the *.class output of the compiler.
« Last Edit: March 10, 2021, 05:06:34 pm by MysticLord »

Voltaire99

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
Re: Looking for a program to compare hex files(like Diff Merge, etc.)
« Reply #11 on: March 22, 2021, 02:23:58 pm »
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