escape-ascii

Crates.ioescape-ascii
lib.rsescape-ascii
version0.1.0
sourcesrc
created_at2023-06-30 09:07:51.286809
updated_at2023-06-30 09:07:51.286809
descriptionAn extremly tiny tool to convert stdin raw byte stream to printable escaped-ascii form (with slice::escape_ascii()), such as byte literals in source codes on many programming languages (e.g. "\x1b\x04printable\x16\n")
homepage
repositoryhttps://github.com/snoopy3476/escape-ascii.git
max_upload_size
id904292
size10,461
Kim Hwiwon (snoopy3476)

documentation

README

Escape ASCII

binary-example-0.png binary-example-1.png

An extremely tiny tool to convert stdin raw byte stream to printable escaped-ascii form, such as byte literals in source codes on many programming languages (e.g. "\x1b\x04printable\x16\n").

This tool just help calling the rust function slice::escape_ascii directly from command line.
For more information about how this tool converts, check the rust official documentations of std::ascii::escape_default.

Install

$ cargo install escape-ascii

Example

  • Get random 10 bytes and convert to escaped-ascii form
$ BYTES="$(cat /dev/urandom | head -c10)"
$ printf "%s" "$BYTES"; echo
��f�YڵH
$ printf "%s" "$BYTES" | escape-ascii; echo
\x8a\x8bf\xa1\x8f\x08Y\xda\xb5H

Author

Kim Hwiwon <kim.hwiwon@outlook.com>

License

The MIT License (MIT)

Commit count: 4

cargo fmt