WerWolv / ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
41.29k stars 1.82k forks source link

[Feature] Show size in bytes for selection #668

Open abotsis opened 1 year ago

abotsis commented 1 year ago

What feature would you like to see?

As a reverse engineer, when I select a block of bytes, imhex currently shows the human-readable size (ie: 2.7KB). I'd like it to see the actual length in bytes instead so I can more easily find that value elsewhere in the binary.

How will this feature be useful to you and others?

When, for example, trying to see if the length for a variable sized string is anywhere in a header preceding it, having the actual count makes it much nicer. Also, given the relatively short length a selection might be (hundreds of KB at the most), truncating the size doesn't really save you that much in space or readability. I could see value in show the size like "55,555 (55.6KB)" or making it click-to-toggle.

As kind of a second part to this, being able to search for a decimal value by checking each positions type against the search input would also make things easier.

Request Type

WerWolv commented 1 year ago

Hey The first part has already been implemented a few commits back. If you want to use it, you can download the latest nightly from my website image

The second part I could see as an addition to the new Find view. The issue is, "searching for a decimal value" isn't really a thing. You'll also need to be able to tell ImHex how this value is encoded, how many bytes it uses and so on. So it also requires a bunch of settings you can change to tell ImHex what exactly you're trying to search for. I can see if I can implement something like that

abotsis commented 1 year ago

I swear I wasn’t creeping commits and just opening issues for stuff you’ve already done. :) That’s awesome, though! Thanks!

For search, I agree. If you’re asking me how it should be done (I don’t think you are but I can’t tell :) - what if you just took the input and found the “smallest” type to encode it, started permuting “up”, and highlighted each matched type as a different color like for patterns? You could even colorize the types in the data inspector to match so once I “learn” the color for a uint16, it’s easy to spot in my results… even more, adding an “overview gutter” or whatever they call the feature those fancy text editors have to show matches would be cool too.