Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

(Partial) compatibility with xxd? #121

Closed
2 tasks done
sharkdp opened this issue Oct 31, 2020 · 5 comments
Closed
2 tasks done

(Partial) compatibility with xxd? #121

sharkdp opened this issue Oct 31, 2020 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@sharkdp
Copy link
Owner

sharkdp commented Oct 31, 2020

I think it would be interesting to try and maintain some level of compatibility with xxd. I recently came across this when following a blog post, trying to use hexyl instead of xxd.

  • The most obvious thing would be to introduce (yet another) alias for --length/--bytes, i.e. -l in addition to -n and -c.
  • Another cool feature of xxd is the -groupsize option. This is already being discussed in Other sizes of data (group size and Endianness) #104.

What other flags/options could we try to support or try to provide aliases for?

What we're definitely not going to support is long single-dash options like -groupsize. Instead, we are always going to keep a style where long options come with two dashes --groupsize.

By the way, one thing that we already do better:

Even though xxd itself doesn't support hexadecimal notation […]

So instead of xxd -s $((0x2118)) ./hello we can simply say hexyl -s 0x2118 ./hello.

Note: we already try to be (partially) compatible with hexdump.

@sharkdp sharkdp changed the title Compatibility with xxd? (Partial) compatibility with xxd? Oct 31, 2020
@sharkdp sharkdp added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Oct 31, 2020
@martinlindhe
Copy link

Another xxd feature that I find is most lacking is -r (reverse hexdump).
Using it you can convert a hexdump into a binary, like this:

xxd file > file.hex
cat file.hex | xxd -r > reconstructed-file

@sharkdp
Copy link
Owner Author

sharkdp commented Dec 5, 2022

We now have a new --group-bytes option in hexyl which is basically the same as xxds -groupsize (?). @RinHizakura why did we call it like that.. and not --groupsize or at least --group-size?

@RinHizakura
Copy link
Contributor

It is basically the same as -groupsize in xxd. Since I didn't aware of the requirement of compatibility, so the naming didn't align with xxd at that time. I think you could change --group-bytes to --groupsize directly if you like it.

@sharkdp
Copy link
Owner Author

sharkdp commented Dec 6, 2022

I see, thanks. I believe we should change it to --groupsize then. At least as an alias. But I don't really see a reason to choose group-bytes over groupsize, if we can get xxd-compatibility this easy.

sharkdp added a commit that referenced this issue Dec 7, 2022
For `xxd`-compatibility reasons

see #121
@sharkdp
Copy link
Owner Author

sharkdp commented Dec 7, 2022

Fixed in 1df35ee.

Another xxd feature that I find is most lacking is -r (reverse hexdump). Using it you can convert a hexdump into a binary, like this:

xxd file > file.hex
cat file.hex | xxd -r > reconstructed-file

That is indeed pretty cool. This would be a major new feature and I don't currently plan on adding it to hexyl. I think it's fair to close this for now.

@sharkdp sharkdp closed this as completed Dec 7, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants