百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
H

hex

> DevOps
开源

一种未来主义的 hexdump 实现,由 Rust 编写。

567 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

一种未来主义的 hexdump 实现,由 Rust 编写。

hx

Futuristic take on hexdump.

hx accepts a file path or stdin as input and outputs a hexadecimal colorized view to stdout.

hx with file path as input, outputting colorized hexadecimal:

bash
$ hx tests/files/alphanumeric.txt
0x000000: 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x6a abcdefghij
0x00000a: 0x6b 0x69 0x6c 0x6d 0x6e 0x6f 0x70 0x71 0x72 0x73 kilmnopqrs
0x000014: 0x74 0x75 0x76 0x77 0x78 0x79 0x7a 0x30 0x31 0x32 tuvwxyz012
0x00001e: 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x0a 0x30 0x31 3456789.01
0x000028: 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x30 0x31 2345678901
0x000032: 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x30 0x31 2345678901
0x00003c: 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39           23456789
   bytes: 68

hx with stdin as input, outputting colorized hexadecimal:

bash
cat tests/files/alphanumeric.txt | hx
0x000000: 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x6a abcdefghij
0x00000a: 0x6b 0x69 0x6c 0x6d 0x6e 0x6f 0x70 0x71 0x72 0x73 kilmnopqrs
0x000014: 0x74 0x75 0x76 0x77 0x78 0x79 0x7a 0x30 0x31 0x32 tuvwxyz012
0x00001e: 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x0a 0x30 0x31 3456789.01
0x000028: 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x30 0x31 2345678901
0x000032: 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x30 0x31 2345678901
0x00003c: 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39           23456789
   bytes: 68

quick links

  • examples
  • installation
  • features
  • help
  • license

examples

lower hex format -fx

$ hx src/main.rs

binary hex format -fb

$ hx -fb -c4 src/main.rs

octal hex format -fo

$ hx -fo -c8 src/main.rs

installation

packaging availability

hx is packaged and available for install on the following platforms:

crates.io install

If cargo is already installed, simply:

bash
cargo install hx

source install

From within the hx source code directory, simply execute:

bash
make install

This will run the following cargo commands:

bash
cargo build --release
cargo test --verbose --all -- --nocapture
cargo install --path .

Which will compile the release version, run tests and install release binary to /.cargo/bin/hx.

If /.cargo/bin is part of the PATH environment variable, hx should be able executable anywhere in the shell.

arch linux install

bash
pacman -S hex

debian install

Browse the latest releases to choose VERSION for use with this debian installation example:

bash
VERSION=0.7.0 && curl -sLO "https://github.com/sitkevij/hex/releases/download/v$VERSION/hx_$VERSION-1_amd64.deb" && dpkg -i "hx_$VERSION-1_amd64.deb"

guix install

bash
guix install hex

In an isolated environment:

bash
guix shell --container hex

docker run

bash
# stdin
cat README.md | docker run -ti sitkevij/hx:latest

# file input with parameters and NO_COLOR environment variable
echo "NO_COLOR=1" >docker_env_vars.ignore.txt &&
docker run -ti --env-file docker_env_vars.ignore.txt -v $(pwd)/README.md:/README.md sitkevij/hx:latest -fo -c8 /README.md

features

output arrays in rust, c, golang, python, fsharp, kotlin, java, or swift

hx has a feature which can output the input file bytes as source code arrays.

For example:

rust array: -ar

bash
$ hx -ar -c8 tests/files/tiny.txt
let ARRAY: [u8; 3] = [
    0x69, 0x6c, 0x0a
];

c array: -ac

bash
$ hx -ac -c8 tests/files/tiny.txt
unsigned char ARRAY[3] = {
    0x69, 0x6c, 0x0a
};

golang array: -ag

bash
$ hx -ag -c8 tests/files/tiny.txt
a := [3]byte{
    0x69, 0x6c, 0x0a,
}

python array: -ap

bash
$ hx -ap -c8 tests/files/tiny.txt
a = [
    0x69, 0x6c, 0x0a
]

kotlin array: -ak

bash
$ hx -ak -c8 tests/files/tiny.txt
val a = byteArrayOf(
    0x69, 0x6c, 0x0a
)

java array: -aj

bash
$ hx -aj -c8 tests/files/tiny.txt
byte[] a = new byte[]{
    0x69, 0x6c, 0x0a
};

swift array: -as

bash
$ hx -as -c8 tests/files/tiny.txt
let a: [UInt8] = [
    0x69, 0x6c, 0x0a
]

fsharp array: -af

bash
$ hx -af -c8 tests/files/tiny.txt
let a = [|
    0x69uy; 0x6cuy; 0x0auy
|]

NO_COLOR support

hx will honor the NO_COLOR environment variable. If set, no color will be output to the terminal.

Rust no_color crate:

help

…

license

MIT

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustasciibinary-databytesdeveloper-tools

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理