Way back in July I was doing some simple binary data file reverse engineering, and got annoyed at the fact that I couldn’t find a free hex editor for Windows which offered all of the following:
- Seeing all interpretations of data (e.g. various integer types, floats and text) while hovering over some binary data.
- Searching data of a given type (e.g. uint32) quickly and conveniently in different numerical formats (e.g. decimal or hex).
- Marking identified pieces of data with their type and some notes.
I thought “it can’t be that hard now, can it?” and set out to create my own. After some deliberation I choose C#/Winforms to implement it, simply because the tool support is second to none and I didn’t want to waste more time on UI stuff than strictly necessary.
After spending a few hours on it way back then, and finally a few more today, it has turned into quite a usable (but far from complete or user-friendly) program. I called it Hexer, which is both appropriate in English and also means “Warlock” (or even “Witcher”, literally) in German.
It has all the features which I was missing:
- The pane on the left shows various interpretations of selected and hovered-over data.
- You can easily enter different types of numerical addresses written in any C-style string format (e.g. “161″ searches for the decimal number 161, “0xFF” searches for decimal 255 and 010 searches for decimal 8).
- As seen in the screenshot, you can mark ranges of data with some data type, and see the in-line interpretation of that data in the file. These markers can be stored and loaded independently of the files they apply to.
I put the source up on GitHub here, and here’s an executable if you want to give it a try. (You’ll need the right version of the .net Runtime of course)
Of the entire implementation I like this part best, which is a simple descriptive listing of all the data types, including their properties (such as name and size) as well as the ability to convert values of that type to and from raw binary and strings. It’s succinct, easy to extend (both with new data types and new meta-information about them), and many of the UI elements are generated directly from that list.
Hexer is far from fully-featured – I put up a short list of TODOs in the Github readme, but there’s a lot more which could (and should) be done.
It look very promising. Its fell lot more “interactive” than standard hex editor.
Whats wrong with wxHexEditor? It’s open source, nicely written, efficient and adding the functionality you need would be quite simple.
It didn’t have all the features I wanted, and adding them would mean working with wxWidgets, which I did in the early 00s and really don’t want to repeat. I like neither the API philosophy/design (which is of course limited by what C++ was in the 90s, to be fair), nor its look on windows OSes.
You are of course entirely correct that it would be a far saner alternative than rolling your own from scratch. But then again, I probably only spent less than 10 hours total on this project, and I had fun with it. Since I’m doing this entirely in my free time for fun I don’t really need to choose the most efficient option every time if it would be less satisfying.