This is nice! I like the colorization a lot -- it's like with source code, you don't realize how much you rely on the colors until you get a new computer and need to download syntax definitions for your editor again. Only feature I really think is missing is line numbers.
Nicely done!
My first thought too. Then I looked and saw it was nice, and then I noticed it's by sharkdp. He really has a knack for improving on things you thought were fine (fd and bat being other examples).
edit: Added in this commit: https://github.com/sharkdp/hexyl/commit/91a119f4537f746045c8...
I wonder though, whether I can colour code 'blocks' to differentiate them? One of the things I seemed to do a lot in hex editors was to check out the differentiation in, for example, 72 byte blocks of data, so to be able to delineate 72 byte blocks in different colours in the hex editor would make it easier to see where each block starts/ends.
00006980: 0000 0000 0000 0000 0000 0000 0000 0000line number = floor(X/(bytes/line)) + 1
column offset = X % (bytes/line) + 1
Or it could just print byte numbers instead of line numbers.
The border lines don't help much either and seem more like decoration; addresses to the left and an indexing header on the top, like the traditional "canonical" hexdump format, would be far more useful.
I did use it religiously for a long, long time; then tried without for a week and never went back.
It's not like telling the difference between string literals and keywords was ever a major issue for me. I guess it could help short term when learning a new language, but I'm pretty sure it slows down overall progress.
Hexyl would look like:
R
\/\/\/.. which is apparently also called "Hexyl". Granted, I was just looking for a short word that starts with "Hex" and I was never good at organic chemistry :-)
xxd `which hexyl` > /dev/null 0.12s user 0.09s system 99% cpu 0.219 total
hexdump `which hexyl` > /dev/null 0.19s user 0.05s system 91% cpu 0.256 total
hexyl `which hexyl` > /dev/null 1.69s user 0.39s system 95% cpu 2.175 total hyperfine './target/release/hexyl ./target/release/hexyl' 'xxd ./target/release/hexyl' 'hexdump ./target/release/hexyl'
Benchmark #1: ./target/release/hexyl ./target/release/hexyl
Time (mean ± σ): 1.529 s ± 0.028 s [User: 1.476 s, System: 0.050 s]
Range (min … max): 1.491 s … 1.581 s 10 runs
Benchmark #2: xxd ./target/release/hexyl
Time (mean ± σ): 70.5 ms ± 0.5 ms [User: 68.0 ms, System: 1.2 ms]
Range (min … max): 69.5 ms … 72.3 ms 41 runs
Benchmark #3: hexdump ./target/release/hexyl
Time (mean ± σ): 262.4 ms ± 2.8 ms [User: 260.1 ms, System: 1.5 ms]
Range (min … max): 259.8 ms … 268.8 ms 11 runs
Summary
'xxd ./target/release/hexyl' ran
3.72 ± 0.05 times faster than 'hexdump ./target/release/hexyl'
21.70 ± 0.43 times faster than './target/release/hexyl ./target/release/hexyl'
Currently hexyl seems nearly 22x slower than xxd.He also authors https://github.com/sharkdp/bat, which is also worth to check out.
As someone who is considering learning Rust, this may just have pushed me over the edge.
http://blog.metaclassofnil.com/?p=757
There's also a vim mode for hex, which I use less often:
https://vi.stackexchange.com/questions/2232/how-can-i-use-vi...
Many moons ago I wrote a very bare bones ncurses hex viewer/editor, after not really being able to find one that fit my needs. I still use it pretty regularly: https://github.com/quo/hex.py
https://www.gnu.org/software/emacs/manual/html_node/emacs/Ed...
This little program should fit nicely into that category. An area I would like to explore, but have little-to-none incentives.
https://github.com/sharkdp/lsd#from-sources
Good work on these tools though. You make me want to learn Rust :)
For other things, I've used it for examining network packets (binary protocols), mystery files, and proprietary data formats. I've also used a hex editor to hack executables (most notably hacking in a dark theme into Unity3D).
Or the Joe editor in -hex mode: https://joe-editor.sourceforge.io/
This is freaking awesome. Been looking for something like this for awhile!
i do seem to have 256 colors in urxvt my $TERM is rxvt-256color and i have rxvt-unicode-256color installed