{"id":33938964,"url":"https://github.com/m0cka/rhexdump","last_synced_at":"2026-03-17T20:04:13.412Z","repository":{"id":57660881,"uuid":"404079773","full_name":"m0cka/rhexdump","owner":"m0cka","description":"A Rust hexdump library to format data in a fast, convenient and customizable manner.","archived":false,"fork":false,"pushed_at":"2023-08-15T14:21:53.000Z","size":49,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-02T11:13:39.617Z","etag":null,"topics":["hex","hexdump","library","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m0cka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-07T18:15:49.000Z","updated_at":"2023-09-08T05:26:18.000Z","dependencies_parsed_at":"2022-08-29T11:31:48.549Z","dependency_job_id":null,"html_url":"https://github.com/m0cka/rhexdump","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/m0cka/rhexdump","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m0cka%2Frhexdump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m0cka%2Frhexdump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m0cka%2Frhexdump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m0cka%2Frhexdump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m0cka","download_url":"https://codeload.github.com/m0cka/rhexdump/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m0cka%2Frhexdump/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30630037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hex","hexdump","library","rust"],"created_at":"2025-12-12T15:06:23.159Z","updated_at":"2026-03-17T20:04:13.406Z","avatar_url":"https://github.com/m0cka.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Version](https://img.shields.io/github/v/tag/m0cka/rhexdump?color=1982c4\u0026style=flat-square) ![License Badge](https://img.shields.io/github/license/m0cka/rhexdump?color=8ac926\u0026style=flat-square) ![Dependencies](https://img.shields.io/badge/dependencies-none-ffca3a?style=flat-square) [![Documentation](https://img.shields.io/badge/documentation-doc.rs-ff595e?style=flat-square)](https://docs.rs/rhexdump/0.2.0/rhexdump/)\n\n# Rhexdump\n\nRhexdump is a hexdump library written in Rust to format data in a fast, convenient and customizable manner.\n\n## Add as a Dependency\n\nAdd the following line under `[dependencies]` in your `Cargo.toml` file.\n\n```toml\nrhexdump = \"0.2.0\"\n```\n\n## Features\n\nRhexdump provides the following features:\n\n* [Macros](#macros) to format data and configure Rhexdump efficiently;\n* [Hexdump utilities](#hexdump-utilities) ready to be used or that can be adapted to your needs;\n* [Iterators](#iterators)\n* [Customizable settings](#customizable-settings) for Rhexdump instances.\n\n### Macros\n\nMacros work on byte slices and can be used to format data to stdout or a string.\n\n```rust\nuse rhexdump::prelude::*;\n\nfn main() {\n    let v = (0..0x80).collect::\u003cVec\u003cu8\u003e\u003e();\n\n    // Hexdumps `v` to stdout using the current global configuration.\n    rhexdump!(\u0026v);\n\n    // 00000000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | ................\n    // 00000010: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f | ................\n    // 00000020: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | .!\"#$%\u0026'()*+,-./\n    // 00000030: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f | 0123456789:;\u003c=\u003e?\n    // 00000040: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f | @ABCDEFGHIJKLMNO\n    // 00000050: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f | PQRSTUVWXYZ[\\]^_\n    // 00000060: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f | `abcdefghijklmno\n    // 00000070: 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f | pqrstuvwxyz{|}~.\n\n\n    // Hexdumps `v` to stdout with an offest using the current global configuration.\n    rhexdump!(\u0026v, 0x12340000);\n\n    // 12340000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | ................\n    // 12340010: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f | ................\n    // 12340020: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | .!\"#$%\u0026'()*+,-./\n    // 12340030: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f | 0123456789:;\u003c=\u003e?\n    // 12340040: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f | @ABCDEFGHIJKLMNO\n    // 12340050: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f | PQRSTUVWXYZ[\\]^_\n    // 12340060: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f | `abcdefghijklmno\n    // 12340070: 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f | pqrstuvwxyz{|}~.\n\n\n    // Returns the hexdump of `v` as a string using the current global configuration.\n    let output = rhexdumps!(\u0026v);\n\n\n    // Returns the hexdump of `v`, with an offset, as a string using the current global\n    // configuration.\n    let output = rhexdumps!(\u0026v, 0x12340000);\n}\n```\n\nBy default, a global configuration is provided to control the macros' output format. This configuration can be changed using the `rhexdump_install` macro. You can find more information about configurations in the [documentation](https://docs.rs/rhexdump/)\n\n```rust\nuse rhexdump::prelude::*;\n\nfn main() {\n    // Data to format.\n    let v = (0..0x14).collect::\u003cVec\u003cu8\u003e\u003e();\n    // Creating a new rhexdump configuration.\n    let config = RhexdumpBuilder::new()\n        .base(Base::Oct)\n        .bit_width(BitWidth::BW64)\n        .group_size(GroupSize::Word)\n        .groups_per_line(4)\n        .config();\n    // Installing the configuration globally.\n    rhexdump_install!(config);\n    // Hexdump of the same data with the new configuration.\n    let output = rhexdumps!(\u0026v);\n    assert_eq!(\n        \u0026output,\n        \"0000000000000000: 000400 001402 002404 003406  ........\\n\\\n        0000000000000008: 004410 005412 006414 007416  ........\\n\\\n        0000000000000010: 010420 011422                ....\\n\"\n    );\n}\n```\n\n### Hexdump Utilities\n\n* Generic hexdump with an offset from a `std::io::Read` object to a `std::io::Write` one.\n\n```rust\nuse rhexdump::prelude::*;\nuse std::io::prelude::*;\nuse std::io::*;\nuse std::env::temp_dir;\nuse std::fs::OpenOptions;\n\nfn main() {\n    // Create a Rhexdump instance.\n    let rhx = Rhexdump::new();\n\n    // Create a temporary output file.\n    let filename = \"rhx_rhexdump_hexdump_offset.test\";\n    let mut test_file = temp_dir();\n    test_file.push(filename);\n    let mut f = OpenOptions::new()\n        .write(true)\n        .read(true)\n        .create(true)\n        .truncate(true)\n        .open(test_file)\n        .expect(\u0026format!(\"Cannot create {}\", filename));\n\n    // String to format.\n    let input = String::from(\"Lorem ipsum dolor sit amet, consectetur adipiscing elit\");\n    let mut cur = Cursor::new(\u0026input);\n\n    // Formatting data to the temp file.\n    rhx.hexdump_offset(\u0026mut f, \u0026mut cur, 0x12340000);\n\n    // Reading the temp file content and making sure it corresponds to the expected output.\n    f.seek(SeekFrom::Start(0))\n        .expect(\u0026format!(\"Could not seek to start of {}\", filename));\n    let mut output = Vec::new();\n    f.read_to_end(\u0026mut output)\n        .expect(\u0026format!(\"Cannot read from {}\", filename));\n    assert_eq!(\n        \u0026String::from_utf8_lossy(\u0026output),\n        \"12340000: 4c 6f 72 65 6d 20 69 70 73 75 6d 20 64 6f 6c 6f  Lorem.ipsum.dolo\\n\\\n         12340010: 72 20 73 69 74 20 61 6d 65 74 2c 20 63 6f 6e 73  r.sit.amet,.cons\\n\\\n         12340020: 65 63 74 65 74 75 72 20 61 64 69 70 69 73 63 69  ectetur.adipisci\\n\\\n         12340030: 6e 67 20 65 6c 69 74                             ng.elit\\n\"\n    );\n}\n```\n\n* Hexdump a byte slice to a [`String`].\n\n```rust\nuse rhexdump::prelude::*;\n\nfn main() {\n    let v = (0..0x14).collect::\u003cVec\u003cu8\u003e\u003e();\n    let rh = RhexdumpString::new();\n    let out = rh.hexdump_bytes(\u0026v);\n    assert_eq!(\n        \u0026out,\n        \"00000000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f  ................\\n\\\n         00000010: 10 11 12 13                                      ....\\n\"\n    );\n}\n```\n\n* Hexdump with an offset a [`std::io::Read`] object to [`std::io::Stdout`].\n\n```rust\nuse rhexdump::prelude::*;\n\nfn main() {\n    // Create a Rhexdump instance.\n    let rhx = RhexdumpStdout::new();\n\n    // String to format.\n    let input = String::from(\"Lorem ipsum dolor sit amet, consectetur adipiscing elit\");\n    let mut cur = std::io::Cursor::new(\u0026input);\n\n    // Formatting data to the temp file.\n    rhx.hexdump_offset(\u0026mut cur, 0x12340000);\n}\n```\n\nRefer to the [documentation](https://docs.rs/rhexdump/) for additional hexdump methods.\n\n### Iterators\n\nThis crate also provides iterators over hexdump-formatted data.\n\n```rust\nuse rhexdump::prelude::*;\n\nfn main() {\n    // Create a Rhexdump instance.\n    let rhx = Rhexdump::new();\n\n    // String to format.\n    let input = String::from(\"Lorem ipsum dolor sit amet, consectetur adipiscing elit\");\n    let mut cur = std::io::Cursor::new(\u0026input);\n\n    // Creating an iterator.\n    let mut iter = RhexdumpStringIter::new(rhx, \u0026mut cur);\n\n    // Taking two lines of output.\n    let _ = iter.next().unwrap();\n    let output = iter.next().unwrap();\n\n    assert_eq!(\n        \u0026output,\n        \"00000010: 72 20 73 69 74 20 61 6d 65 74 2c 20 63 6f 6e 73  r.sit.amet,.cons\"\n    );\n}\n```\n\n### Customizable Settings\n\nUse the `RhexdumpBuilder` object to construct a customized configuration for your data.\n\n```rust\nuse rhexdump::prelude::*;\n\nfn main() {\n    let v = (0..0x10).collect::\u003cVec\u003cu8\u003e\u003e();\n    let rh = RhexdumpBuilder::new()\n        .group_size(GroupSize::Dword)\n        .groups_per_line(4)\n        .endianness(Endianness::BigEndian)\n        .build_string();\n    let out = rh.hexdump_bytes(\u0026v);\n    assert_eq!(\n        \u0026out,\n        \"00000000: 00010203 04050607 08090a0b 0c0d0e0f  ................\\n\"\n    );\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm0cka%2Frhexdump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm0cka%2Frhexdump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm0cka%2Frhexdump/lists"}