Skip to content

(Partial) compatibility with xxd? #121

Closed

Description

@sharkdp

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.

Activity

  1. changed the title [-]Compatibility with xxd?[/-] [+](Partial) compatibility with xxd?[/+] on Oct 31, 2020
  2. added
    enhancement
    good first issue
    help wanted
    on Oct 31, 2020
  3. martinlindhe commented on Jan 24, 2022

    @martinlindhe

    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
    
  4. sharkdp commented on Dec 5, 2022

    @sharkdp
    OwnerAuthor

    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?

  5. RinHizakura commented on Dec 6, 2022

    @RinHizakura
    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.

  6. sharkdp commented on Dec 6, 2022

    @sharkdp
    OwnerAuthor

    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.

  7. added a commit that references this issue on Dec 7, 2022
  8. sharkdp commented on Dec 7, 2022

    @sharkdp
    OwnerAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions