{"id":16858137,"url":"https://github.com/ogham/hexit","last_synced_at":"2025-07-23T00:04:12.038Z","repository":{"id":66117931,"uuid":"317010410","full_name":"ogham/hexit","owner":"ogham","description":"A hexadecimal emitter language.","archived":false,"fork":false,"pushed_at":"2021-11-01T14:35:59.000Z","size":222,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T08:31:00.671Z","etag":null,"topics":["bytes","file-formats","hexadecimal","network-protocols","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ogham.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-29T17:56:22.000Z","updated_at":"2024-08-16T19:40:06.000Z","dependencies_parsed_at":"2023-02-20T19:45:39.224Z","dependency_job_id":null,"html_url":"https://github.com/ogham/hexit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ogham/hexit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogham%2Fhexit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogham%2Fhexit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogham%2Fhexit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogham%2Fhexit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ogham","download_url":"https://codeload.github.com/ogham/hexit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogham%2Fhexit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266592178,"owners_count":23953108,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bytes","file-formats","hexadecimal","network-protocols","rust"],"created_at":"2024-10-13T14:11:44.182Z","updated_at":"2025-07-23T00:04:12.011Z","avatar_url":"https://github.com/ogham.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Hexit\n=====\n\nHexit is a tiny programming language that deals with bytes. It’s useful for writing binary formats and network packets without the tedium of forgetting which byte means what, or having to stumble around a hex editor. I like to think of it as “Markdown for binary”.\n\nAs an interpreted programming language, Hexit works like other interpreters: give it a file to run, or it’ll expect a program on stdin.\n\n    hexit [OPTIONS] PROGRAM.hexit\n\n\nFull Example\n------------\n\nHere’s an example of a Hexit program, describing a BGP packet:\n\n    # Header\n    Marker:    x12(FF)\n    Length:    be32[29]\n    Type:      BGP_OPEN\n    Version:   04\n    ASN:       be32[12345]\n    Hold time: be32[180]\n\n    # Data\n    Identifier: [192.168.0.1]\n    Optional params: 00\n\nAnd here’s what it emits:\n\n    FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF001D0104303900B4C0A8000100\n\n- The text after a `#` is a comment. Anything on a line before a colon is a comment, too (reverse comments!)\n- Bytes are read in as pairs of hex characters. Everything from `00` to `FF` just outputs itself. You don’t need to prefix anything with `0x`. These _must_ be paired: `0` on its own is a syntax error.\n- Decimal numbers are enclosed in square brackets. `FF` and `[255]` are equivalent.\n- Function calls use parentheses. `x12(FF)` applies the function `x12` to the byte `FF`. That function repeats the byte twelve times. (There are others like it.) You don’t need commas to separate arguments.\n- Decimal numbers larger than 255 aren’t accepted by themselves. You’ll need to specify a size and endianness to output them. This is done by functions such as `be32` (big-endian, 4 bytes wide) or `le16` (little, 2 bytes).\n- Passing one decimal number to a function is so common, you can write `be32[180]` instead of `be32([180])`.\n- IPv4 addresses resolve to four bytes.\n\n\nCustomising the output\n----------------------\n\nBy default, Hexit prints out its bytes using two hex characters each: an input consisting of two characters `6` and `B` will be written using those same two characters, `6` and `B`.\n\nIf you’re actually sending data somewhere, though, you might prefer it to output the _byte_ 0x6B (which is 107 in decimal, or `k` in ASCII). You can do this with `--raw`. Alternatively you can pipe the output through `xxd -r -p`.\n\nIf you want the output to be _more_ human-readable, you can use these options to make it a bit prettier:\n\n- **--prefix**: String to print _before_ a pair of hex characters.\n- **--suffix**: String to print _after_ a pair of hex characters.\n- **--separator**: String to print _between_ successive pairs of hex characters.\n- **--lowercase**: If you like your letters minuscule.\n\nA nice example is `--separator=\":\"` for colon-separated bytes. Or `--prefix=\"0x\" --separator=\" \"` if you need another program to read the bytes back in.\n\u003c!-- I know you don’t strictly need the quotes! --\u003e\n\n\nChecking the output\n-------------------\n\nYou can verify that the output seems correct with one of these options:\n\n- **--verify-length**: If you know the exact length the output should be, you can tell Hexit to fail if it’s not.\n- **--verify-boundary**: Similarly, if you don’t know the length, but _do_ know that it should be a multiple of a power of two, you can check that it falls on the correct byte boundary.\n\n\nWhat it doesn’t do\n------------------\n\n- It doesn’t send data over a network. Use `netcat` or `nping` for that.\n- It doesn’t make streams of data human-readable. Use `xxd` for that.\n- It doesn’t parse streams of data back into their structures. Use Wireshark or `file` for that.\n\n\nLicence\n-------\n\nHexit is dual-licenced under the [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/) and [MIT](https://opensource.org/licenses/MIT) licences. For more information, see the [Why the licence?](https://github.com/ogham/hexit/wiki/Why-the-licence%3F) wiki page.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fogham%2Fhexit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fogham%2Fhexit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fogham%2Fhexit/lists"}