hexxy/README.md

76 lines
1.8 KiB
Markdown
Raw Normal View History

<p align="center">
<img src="assets/hexxy.png" />
<div align="center">A modern alternative to `xxd` and `hexdump`</div>
</p>
2024-01-15 23:49:16 +00:00
![example of hexxy in action](assets/img.png)
2024-01-16 00:18:43 +00:00
2024-02-02 01:52:44 +00:00
## Quick install
requirements: Go 1.20+ (it may build with earlier versions as well but I have not tested them) and git
```sh
git clone https://github.com/sweetbbak/hexxy && cd hexxy
go build
```
2024-01-15 23:49:16 +00:00
## Example usage
2024-02-02 01:52:44 +00:00
2024-01-15 23:49:16 +00:00
```sh
2024-02-02 01:52:44 +00:00
# normal usage
2024-01-15 23:49:16 +00:00
hexxy /path/to/file.bin
2024-02-02 01:52:44 +00:00
# output without color
2024-01-15 23:49:16 +00:00
hexxy --no-color /path/to/file.bin
2024-02-02 01:52:44 +00:00
2024-01-15 23:49:16 +00:00
# read from stdin
cat mybinary | hexxy
2024-02-02 01:52:44 +00:00
# display plain output
hexxy -p file.bin
# Include a binary as a C variable
hexxy -i input-file > output.c
# Use plain non-formatted output
hexxy -p input-file
# crunch empty lines with a '*' and use uppercase HEX
hexxy -a --upper input-file
# Reverse plain non-formatted output (reverse plain)
hexxy -rp input-file
# Show output with a space in between N groups of bytes
hexxy -g1 input-file ... -> outputs: 00000000: 0f 1a ff ff 00 aa
2024-01-16 00:21:26 +00:00
# display offset in Decimal format
hexxy -td file.bin
2024-02-02 01:52:44 +00:00
2024-01-25 20:35:41 +00:00
# display offset in Octal format
hexxy -to file.bin
2024-01-15 23:49:16 +00:00
```
2024-02-02 01:52:44 +00:00
## Performance
`zk` is a 17mb binary
```sh
xxd -i ~/bin/zk &> /dev/null 0.66s user 0.02s system 99% cpu 0.677 total
hexxy -i ~/bin/zk &> /dev/null 0.16s user 0.01s system 98% cpu 0.165 total
```
```sh
# plain XXD
xxd ~/bin/zk &> /dev/null 0.12s user 0.01s system 99% cpu 0.126 total
# hexxy without color
hexxy -N ~/bin/zk &> /dev/null 0.21s user 0.01s system 100% cpu 0.223 total
# hexxy with color
hexxy ~/bin/zk &> /dev/null 0.37s user 0.01s system 99% cpu 0.383 total
```
## Credits
thanks to [felixge](https://github.com/felixge/go-xxd) for showing how this is done quickly
thanks to [igoracmelo](https://github.com/igoracmelo/xx) for the idea to colorize hexdump output with a gradient