{"id":26487698,"url":"https://github.com/nicoretti/xxd-rs","last_synced_at":"2025-08-31T23:35:28.339Z","repository":{"id":18462182,"uuid":"85233247","full_name":"Nicoretti/xxd-rs","owner":"Nicoretti","description":"make a hexdump or do the reverse.","archived":false,"fork":false,"pushed_at":"2022-09-23T17:00:22.000Z","size":3937,"stargazers_count":16,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T08:02:14.152Z","etag":null,"topics":["commandline","conversion","hacktoberfest","hexdump","xxd"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nicoretti.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":"2017-03-16T19:17:50.000Z","updated_at":"2025-03-12T19:23:39.000Z","dependencies_parsed_at":"2022-07-26T22:46:54.573Z","dependency_job_id":null,"html_url":"https://github.com/Nicoretti/xxd-rs","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nicoretti%2Fxxd-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nicoretti%2Fxxd-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nicoretti%2Fxxd-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nicoretti%2Fxxd-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nicoretti","download_url":"https://codeload.github.com/Nicoretti/xxd-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244566927,"owners_count":20473451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["commandline","conversion","hacktoberfest","hexdump","xxd"],"created_at":"2025-03-20T06:51:17.246Z","updated_at":"2025-03-20T06:51:17.793Z","avatar_url":"https://github.com/Nicoretti.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xxd-rs [![crates-io](https://img.shields.io/crates/v/xxd-rs.svg)](https://crates.io/crates/xxd-rs)\nA rust based reimplementation of [Juergen Weigert's](jnweiger@informatik.uni-erlangen.de) hexdump utility, xxd.\n\n## Mission statement\nThis project was created to learn rust, therefore there is no perf\nIf you wanna use the project or contribute feel free, but please take note\nof the goal(s) and non goals so you won't waste your time or get frustrated.\n\n### Goals\n1. Learn rust\n2. Provide a rust based replacement for xxd\n3. Strive towards a clean rust code base\n    - rustfmt\n    - Add/refactor towards common rust idioms\n4. Usability\n    - Provide user friendly defaults\n    - Provide clear and well documented command line tools\n5. Continuously improve the code base\n\n\n### Non Goals\nWhat this Project isn't about\n\n1. Implement the fastest dump utility out there\n \n### Alternatives\n   * [hexyl](https://github.com/sharkdp/hexyl)\n   * [go-xxd](https://github.com/felixge/go-xxd)\n\n## Usage\n```\nUSAGE:\n    xxd-rs [OPTIONS] [SUBCOMMAND]\n\nFLAGS:\n    -h, --help       Prints help information\n    -V, --version    Prints version information\n\nOPTIONS:\n    -l, --length \u003clength\u003e          Amount of bytes which shall be read\n    -o, --output-file \u003coutfile\u003e    File to which the output will be written (default: stdout)\n    -s, --seek \u003cseek\u003e              Offset in the file where to start reading\n\nSUBCOMMANDS:\n    dump        Dumps an input file in the appropriate output format\n    generate    Generates a source file containing the specified file as array\n    help        Prints this message or the help of the given subcommand(s)\n```\n\n## Examples\n1. Dump file\n```\nuser@host:~$ xxd-rs dump file.txt\n```\n\n2. Dump file with 16 bit word size\n```\nuser@host:~$ xxd-rs generate -g 2 file.txt\n```\n\n3. Dump 1024 bytes of file file starting at offset 128\n```\nuser@host:~$ xxd-rs dump -s 128 -l 1024 file.txt\n```\n\n4. Generate cpp header file containing file in an cpp array\n```\nuser@host:~$ xxd-rs generate -t cpp file.txt\n```\n\n## Migration/Compatibility\nBe aware that the output formats (especially the default) of hexdump, xxd, od, and xxd-rs differ.\n\n1. Dump file\n    1. xxd\n    ```\n    user@host:~$ xxd file\n    ```\n    2. od\n    ```\n    user@host:~$ od file\n    ```\n    3. hexdump\n    ```\n    user@host:~$ xxd-rs dump file\n    ```\n    4. xxd-rs\n    ```\n    user@host:~$ xxd-rs dump file\n    ```\n\n## Screenshots\n### hex dump\n```\nuser@host:~$ xxd-rs dump Cargo.toml\n00000000: 5b70 6163 6b61 6765 5d0a 6e61 6d65 203d  [package].name =\n00000010: 2022 7878 642d 7273 220a 6465 7363 7269   \"xxd-rs\".descri\n00000020: 7074 696f 6e20 3d20 2241 2072 7573 7420  ption = \"A rust\n00000030: 636c 6f6e 6520 6f66 2078 7864 220a 7265  clone of xxd\".re\n00000040: 706f 7369 746f 7279 203d 2022 6874 7470  pository = \"http\n00000050: 733a 2f2f 6769 7468 7562 2e63 6f6d 2f4e  s://github.com/N\n00000060: 6963 6f72 6574 7469 2f78 7864 2d72 7322  icoretti/xxd-rs\"\n00000070: 0a72 6561 646d 6520 3d20 2252 4541 444d  .readme = \"READM\n00000080: 452e 6d64 220a 6175 7468 6f72 7320 3d20  E.md\".authors =\n00000090: 5b22 4e69 636f 6c61 2043 6f72 6574 7469  [\"Nicola Coretti\n000000A0: 203c 6e69 636f 2e63 6f72 6574 7469 4067   \u003cnico.coretti@g\n000000B0: 6d61 696c 2e63 6f6d 3e22 5d0a 6b65 7977  mail.com\u003e\"].keyw\n000000C0: 6f72 6473 203d 205b 2278 7864 222c 2022  ords = [\"xxd\", \"\n000000D0: 6865 782d 6475 6d70 225d 0a6c 6963 656e  hex-dump\"].licen\n000000E0: 7365 2d66 696c 6520 3d20 224c 4943 454e  se-file = \"LICEN\n000000F0: 5345 220a 7665 7273 696f 6e20 3d20 2230  SE\".version = \"0\n00000100: 2e32 2e31 220a 6275 696c 6420 3d20 2262  .2.1\".build = \"b\n00000110: 7569 6c64 2e72 7322 0a0a 5b62 6164 6765  uild.rs\"..[badge\n00000120: 735d 0a61 7070 7665 796f 7220 3d20 7b20  s].appveyor = {\n00000130: 7265 706f 7369 746f 7279 203d 2022 4e69  repository = \"Ni\n00000140: 636f 7265 7474 692f 7878 642d 7273 222c  coretti/xxd-rs\",\n00000150: 2062 7261 6e63 6820 3d20 226d 6173 7465   branch = \"maste\n00000160: 7222 2c20 7365 7276 6963 6520 3d20 2267  r\", service = \"g\n00000170: 6974 6875 6222 207d 0a74 7261 7669 732d  ithub\" }.travis-\n00000180: 6369 203d 207b 2072 6570 6f73 6974 6f72  ci = { repositor\n00000190: 7920 3d20 224e 6963 6f72 6574 7469 2f78  y = \"Nicoretti/x\n000001A0: 7864 2d72 7322 2c20 6272 616e 6368 203d  xd-rs\", branch =\n000001B0: 2022 6d61 7374 6572 2220 7d0a 0a5b 6275   \"master\" }..[bu\n000001C0: 696c 642d 6465 7065 6e64 656e 6369 6573  ild-dependencies\n000001D0: 5d0a 636c 6170 203d 2022 322e 3136 2e32  ].clap = \"2.16.2\n000001E0: 220a 0a5b 6c69 625d 0a6e 616d 6520 3d20  \"..[lib].name =\n000001F0: 2278 7864 220a 7061 7468 203d 2022 7372  \"xxd\".path = \"sr\n00000200: 632f 7878 642f 6c69 622e 7273 220a 0a5b  c/xxd/lib.rs\"..[\n00000210: 5b62 696e 5d5d 0a6e 616d 6520 3d20 2278  [bin]].name = \"x\n00000220: 7864 2d72 7322 0a74 6573 7420 3d20 6661  xd-rs\".test = fa\n00000230: 6c73 650a 646f 6320 3d20 6661 6c73 650a  lse.doc = false.\n00000240: 0a5b 6465 7065 6e64 656e 6369 6573 5d0a  .[dependencies].\n00000250: 6e6f 6d20 3d20 2233 2e30 2e30 220a 6572  nom = \"3.0.0\".er\n00000260: 726f 722d 6368 6169 6e20 3d20 2230 2e39  ror-chain = \"0.9\n00000270: 2e30 220a 7465 726d 2d70 6169 6e74 6572  .0\".term-painter\n00000280: 203d 2022 302e 322e 3322 0a63 6c61 7020   = \"0.2.3\".clap\n00000290: 3d20 2232 2e31 362e 3222 0a\n```\n\n```\nuser@host:~$ xxd-rs dump -f Hex Cargo.toml\n00000000: 5B70 6163 6B61 6765 5D0A 6E61 6D65 203D  [package].name =\n00000010: 2022 7878 642D 7273 220A 6465 7363 7269   \"xxd-rs\".descri\n00000020: 7074 696F 6E20 3D20 2241 2072 7573 7420  ption = \"A rust\n00000030: 636C 6F6E 6520 6F66 2078 7864 220A 7265  clone of xxd\".re\n00000040: 706F 7369 746F 7279 203D 2022 6874 7470  pository = \"http\n00000050: 733A 2F2F 6769 7468 7562 2E63 6F6D 2F4E  s://github.com/N\n00000060: 6963 6F72 6574 7469 2F78 7864 2D72 7322  icoretti/xxd-rs\"\n00000070: 0A72 6561 646D 6520 3D20 2252 4541 444D  .readme = \"READM\n00000080: 452E 6D64 220A 6175 7468 6F72 7320 3D20  E.md\".authors =\n00000090: 5B22 4E69 636F 6C61 2043 6F72 6574 7469  [\"Nicola Coretti\n000000A0: 203C 6E69 636F 2E63 6F72 6574 7469 4067   \u003cnico.coretti@g\n000000B0: 6D61 696C 2E63 6F6D 3E22 5D0A 6B65 7977  mail.com\u003e\"].keyw\n000000C0: 6F72 6473 203D 205B 2278 7864 222C 2022  ords = [\"xxd\", \"\n000000D0: 6865 782D 6475 6D70 225D 0A6C 6963 656E  hex-dump\"].licen\n000000E0: 7365 2D66 696C 6520 3D20 224C 4943 454E  se-file = \"LICEN\n...\n```\n\n### octal dump\n```\nuser@host:~$ xxd-rs dump -f oct Cargo.toml\n00000000: 133160 141143 153141 147145 135012 156141 155145 040075  [package].name =\n00000010: 040042 170170 144055 162163 042012 144145 163143 162151   \"xxd-rs\".descri\n00000020: 160164 151157 156040 075040 042101 040162 165163 164040  ption = \"A rust\n00000030: 143154 157156 145040 157146 040170 170144 042012 162145  clone of xxd\".re\n00000040: 160157 163151 164157 162171 040075 040042 150164 164160  pository = \"http\n00000050: 163072 057057 147151 164150 165142 056143 157155 057116  s://github.com/N\n00000060: 151143 157162 145164 164151 057170 170144 055162 163042  icoretti/xxd-rs\"\n00000070: 012162 145141 144155 145040 075040 042122 105101 104115  .readme = \"READM\n00000080: 105056 155144 042012 141165 164150 157162 163040 075040  E.md\".authors =\n00000090: 133042 116151 143157 154141 040103 157162 145164 164151  [\"Nicola Coretti\n000000A0: 040074 156151 143157 056143 157162 145164 164151 100147   \u003cnico.coretti@g\n000000B0: 155141 151154 056143 157155 076042 135012 153145 171167  mail.com\u003e\"].keyw\n000000C0: 157162 144163 040075 040133 042170 170144 042054 040042  ords = [\"xxd\", \"\n000000D0: 150145 170055 144165 155160 042135 012154 151143 145156  hex-dump\"].licen\n000000E0: 163145 055146 151154 145040 075040 042114 111103 105116  se-file = \"LICEN\n...\n```\n\n### binary dump\n```\nuser@host:~$ xxd-rs dump -f bin -g 2 -c 4 Cargo.toml\n00000000: 0101101101110000 0110000101100011 0110101101100001 0110011101100101  [package\n00000008: 0101110100001010 0110111001100001 0110110101100101 0010000000111101  ].name =\n00000010: 0010000000100010 0111100001111000 0110010000101101 0111001001110011   \"xxd-rs\n00000018: 0010001000001010 0110010001100101 0111001101100011 0111001001101001  \".descri\n00000020: 0111000001110100 0110100101101111 0110111000100000 0011110100100000  ption =\n00000028: 0010001001000001 0010000001110010 0111010101110011 0111010000100000  \"A rust\n00000030: 0110001101101100 0110111101101110 0110010100100000 0110111101100110  clone of\n00000038: 0010000001111000 0111100001100100 0010001000001010 0111001001100101   xxd\".re\n00000040: 0111000001101111 0111001101101001 0111010001101111 0111001001111001  pository\n00000048: 0010000000111101 0010000000100010 0110100001110100 0111010001110000   = \"http\n00000050: 0111001100111010 0010111100101111 0110011101101001 0111010001101000  s://gith\n00000058: 0111010101100010 0010111001100011 0110111101101101 0010111101001110  ub.com/N\n00000060: 0110100101100011 0110111101110010 0110010101110100 0111010001101001  icoretti\n00000068: 0010111101111000 0111100001100100 0010110101110010 0111001100100010  /xxd-rs\"\n...\n```\n\n### decimal dump\n```\nuser@host:~$ xxd-rs dump -f dec Cargo.toml\n00000000: 091112 097099 107097 103101 093010 110097 109101 032061  [package].name =\n00000010: 032034 120120 100045 114115 034010 100101 115099 114105   \"xxd-rs\".descri\n00000020: 112116 105111 110032 061032 034065 032114 117115 116032  ption = \"A rust\n00000030: 099108 111110 101032 111102 032120 120100 034010 114101  clone of xxd\".re\n00000040: 112111 115105 116111 114121 032061 032034 104116 116112  pository = \"http\n00000050: 115058 047047 103105 116104 117098 046099 111109 047078  s://github.com/N\n00000060: 105099 111114 101116 116105 047120 120100 045114 115034  icoretti/xxd-rs\"\n00000070: 010114 101097 100109 101032 061032 034082 069065 068077  .readme = \"READM\n00000080: 069046 109100 034010 097117 116104 111114 115032 061032  E.md\".authors =\n00000090: 091034 078105 099111 108097 032067 111114 101116 116105  [\"Nicola Coretti\n000000A0: 032060 110105 099111 046099 111114 101116 116105 064103   \u003cnico.coretti@g\n000000B0: 109097 105108 046099 111109 062034 093010 107101 121119  mail.com\u003e\"].keyw\n000000C0: 111114 100115 032061 032091 034120 120100 034044 032034  ords = [\"xxd\", \"\n000000D0: 104101 120045 100117 109112 034093 010108 105099 101110  hex-dump\"].licen\n000000E0: 115101 045102 105108 101032 061032 034076 073067 069078  se-file = \"LICEN\n...\n```\n\n### plain dump\n```\nuser@host:~$ xxd-rs dump -g 4 -p Cargo.toml\n5b7061636b6167655d0a6e616d65203d20227878642d7273220a646573637269\n7074696f6e203d202241207275737420636c6f6e65206f6620787864220a7265\n706f7369746f7279203d202268747470733a2f2f6769746875622e636f6d2f4e\n69636f72657474692f7878642d7273220a726561646d65203d2022524541444d\n452e6d64220a617574686f7273203d205b224e69636f6c6120436f7265747469\n203c6e69636f2e636f726574746940676d61696c2e636f6d3e225d0a6b657977\n6f726473203d205b22787864222c20226865782d64756d70225d0a6c6963656e\n73652d66696c65203d20224c4943454e5345220a76657273696f6e203d202230\n2e322e31220a6275696c64203d20226275696c642e7273220a0a5b6261646765\n735d0a6170707665796f72203d207b207265706f7369746f7279203d20224e69\n636f72657474692f7878642d7273222c206272616e6368203d20226d61737465\n72222c2073657276696365203d202267697468756222207d0a7472617669732d\n6369203d207b207265706f7369746f7279203d20224e69636f72657474692f78\n78642d7273222c206272616e6368203d20226d617374657222207d0a0a5b6275\n696c642d646570656e64656e636965735d0a636c6170203d2022322e31362e32\n220a0a5b6c69625d0a6e616d65203d2022787864220a70617468203d20227372\n632f7878642f6c69622e7273220a0a5b5b62696e5d5d0a6e616d65203d202278\n78642d7273220a74657374203d2066616c73650a646f63203d2066616c73650a\n0a5b646570656e64656e636965735d0a6e6f6d203d2022332e302e30220a6572\n726f722d636861696e203d2022302e392e30220a7465726d2d7061696e746572\n203d2022302e322e33220a636c6170203d2022322e31362e32220a\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicoretti%2Fxxd-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicoretti%2Fxxd-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicoretti%2Fxxd-rs/lists"}