{"id":27667722,"url":"https://github.com/cryspen/hax","last_synced_at":"2026-01-17T18:58:34.751Z","repository":{"id":89401261,"uuid":"593381522","full_name":"cryspen/hax","owner":"cryspen","description":"A Rust verification tool","archived":false,"fork":false,"pushed_at":"2025-04-17T14:51:00.000Z","size":58543,"stargazers_count":249,"open_issues_count":181,"forks_count":22,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-21T11:42:47.167Z","etag":null,"topics":["formal-verification","rust"],"latest_commit_sha":null,"homepage":"https://hax.cryspen.com","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cryspen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-01-25T21:35:45.000Z","updated_at":"2025-04-21T03:09:38.000Z","dependencies_parsed_at":"2024-01-01T23:32:46.244Z","dependency_job_id":"eb49812e-58be-44a0-b3f9-53255a769753","html_url":"https://github.com/cryspen/hax","commit_stats":null,"previous_names":["hacspec/hax","cryspen/hax"],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryspen%2Fhax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryspen%2Fhax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryspen%2Fhax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryspen%2Fhax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cryspen","download_url":"https://codeload.github.com/cryspen/hax/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250661246,"owners_count":21466965,"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":["formal-verification","rust"],"created_at":"2025-04-24T16:00:56.417Z","updated_at":"2026-01-17T18:58:34.745Z","avatar_url":"https://github.com/cryspen.png","language":"OCaml","funding_links":[],"categories":["Projects","Verifiers"],"sub_categories":["Verification"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"logo.svg\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://hacspec.zulipchat.com/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Zulip-50ADFF?logo=Zulip\u0026logoColor=white\" alt=\"Zulip\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://hax-playground.cryspen.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/try-Playground-1f6feb\" alt=\"Playground\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://hax.cryspen.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/docs-Website-brightgreen\" alt=\"Website\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://hax.cryspen.com/blog\"\u003e\u003cimg src=\"https://img.shields.io/badge/Blog-9b59b6\" alt=\"Blog\"\u003e\u003c/a\u003e\n  \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-Apache--2.0-blue.svg\" alt=\"License: Apache-2.0\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# Hax\n\nhax is a tool for high assurance translations of a large subset of\nRust into formal languages such as [F\\*](https://www.fstar-lang.org/) or [Rocq](https://rocq-prover.org/).\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://hax-playground.cryspen.com/#fstar+tc/latest-main/gist=5252f86237adbca7fdeb7a8fea0b1648\"\u003e\n    Try out hax online now!\n    \u003c/a\u003e\n\u003c/p\u003e\n\n### Supported Backends\n\n\u003ctable align=\"center\"\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\" colspan=\"3\"\u003e\n      General purpose proof assistants\n    \u003c/td\u003e\n    \u003ctd align=\"center\" colspan=\"2\"\u003e\n      Cryptography \u0026 protocols\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003ca href=\"https://www.fstar-lang.org/\"\u003e\n        F*\n        \u003c!-- \u003cpicture\u003e\n          \u003csource srcset=\".github/assets/fstar-dark.png\" media=\"(prefers-color-scheme: dark)\"\u003e\n          \u003csource srcset=\".github/assets/fstar-light.png\" media=\"(prefers-color-scheme: light)\"\u003e\n          \u003cimg src=\".github/assets/fstar-light.png\" height=\"40\" alt=\"F*\"\u003e\n        \u003c/picture\u003e --\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003ca href=\"https://rocq-prover.org/\"\u003e\n        \u003cpicture\u003e\n          \u003csource srcset=\".github/assets/rocq-dark.svg\" media=\"(prefers-color-scheme: dark)\"\u003e\n          \u003csource srcset=\".github/assets/rocq-light.svg\" media=\"(prefers-color-scheme: light)\"\u003e\n          \u003cimg src=\".github/assets/rocq-light.svg\" height=\"18\" alt=\"Rocq\"\u003e\n        \u003c/picture\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\" style=\"vertical-align: center; \"\u003e\n      \u003ca href=\"https://lean-lang.org/\"\u003e\n        \u003cpicture\u003e\n          \u003csource srcset=\".github/assets/lean-dark.svg\" media=\"(prefers-color-scheme: dark)\"\u003e\n          \u003csource srcset=\".github/assets/lean-light.svg\" media=\"(prefers-color-scheme: light)\"\u003e\n          \u003cimg src=\".github/assets/lean-light.svg\" height=\"18\" alt=\"Lean\"\u003e\n        \u003c/picture\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003ca href=\"https://github.com/SSProve/ssprove\"\u003e\n        \u003cpicture\u003e\n          \u003csource srcset=\".github/assets/ssprove-dark.svg\" media=\"(prefers-color-scheme: dark)\"\u003e\n          \u003csource srcset=\".github/assets/ssprove-light.svg\" media=\"(prefers-color-scheme: light)\"\u003e\n          \u003cimg src=\".github/assets/ssprove-light.svg\" height=\"18\" alt=\"SSProve\"\u003e\n        \u003c/picture\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003ca href=\"https://proverif.inria.fr/\"\u003e\n        \u003cb\u003eProVerif\u003c/b\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003c!-- 🟢🟡🟠🔴 --\u003e\n    \u003ctd align=\"center\"\u003e\u003csub\u003e🟢 stable\u003c/sub\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003csub\u003e🟡 partial\u003c/sub\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003csub\u003e🚀 active dev.\u003c/sub\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003csub\u003e🟡 partial\u003c/sub\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003csub\u003e🟠 PoC\u003c/sub\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n## Learn more\n\nHere are some resources for learning more about hax:\n\n - [Manual](https://hax.cryspen.com/manual/index.html) (work in progress)\n    + Quick start: [F*](https://hax.cryspen.com/manual/fstar/quick_start/), [Lean](https://hax.cryspen.com/manual/lean/quick_start/)\n    + Tutorial: [F*](https://hax.cryspen.com/manual/fstar/tutorial/), [Lean](https://hax.cryspen.com/manual/lean/tutorial/)\n - [Examples](./examples/): the [examples directory](./examples/) contains\n   a set of examples that show what hax can do for you.\n - Other [specifications](https://github.com/hacspec/specs) of cryptographic protocols.\n\nQuestions? Join us on [Zulip](https://hacspec.zulipchat.com/) or open a [GitHub Discussion](https://github.com/cryspen/hax/discussions). For bugs, file an [Issue](https://github.com/cryspen/hax/issues).\n\n## Usage\nHax is a cargo subcommand. \nThe command `cargo hax` accepts the following subcommands:\n * **`into`** (`cargo hax into BACKEND`): translate a Rust crate to the backend `BACKEND` (e.g. `fstar`, `coq`, `lean`).\n * **`json`** (`cargo hax json`): extract the typed AST of your crate as a JSON file.\n \nNote:\n * `BACKEND` can be `fstar`, `lean`, `coq`, `easycrypt` or `pro-verif`. `cargo hax into --help`\n   gives the full list of supported backends.\n * The subcommands `cargo hax`, `cargo hax into` and `cargo hax into\n   \u003cBACKEND\u003e` takes options. For instance, you can `cargo hax into\n   fstar --z3rlimit 100`. Use `--help` on those subcommands to list\n   all options.\n\n## Installation\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eManual installation\u003c/b\u003e\u003c/summary\u003e\n\n1. Make sure to have the following installed on your system:\n\n- [`opam`](https://opam.ocaml.org/) (`opam switch create 5.1.1`)\n- [`rustup`](https://rustup.rs/)\n- [`nodejs`](https://nodejs.org/)\n- [`jq`](https://jqlang.github.io/jq/)\n\n2. Clone this repo: `git clone git@github.com:cryspen/hax.git \u0026\u0026 cd hax`\n3. Run the [setup.sh](./setup.sh) script: `./setup.sh`.\n4. Run `cargo-hax --help`\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eNix\u003c/b\u003e\u003c/summary\u003e\n\n This should work on [Linux](https://nixos.org/download.html#nix-install-linux), [MacOS](https://nixos.org/download.html#nix-install-macos) and [Windows](https://nixos.org/download.html#nix-install-windows).\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003ePrerequisites:\u003c/b\u003e \u003ca href=\"https://nixos.org/\"\u003eNix package\nmanager\u003c/a\u003e \u003ci\u003e(with \u003ca href=\"https://nixos.wiki/wiki/Flakes\"\u003eflakes\u003c/a\u003e enabled)\u003c/i\u003e\u003c/summary\u003e\n\n  - Either using the [Determinate Nix Installer](https://github.com/DeterminateSystems/nix-installer), with the following bash one-liner:\n    ```bash\n    curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install\n    ```\n  - or following [those steps](https://github.com/mschwaig/howto-install-nix-with-flake-support).\n\n\u003c/details\u003e\n\n+ **Run hax on a crate directly** to get F\\*/Coq/Lean/... (assuming you are in the crate's folder):\n   - `nix run github:hacspec/hax -- into fstar` extracts F*.\n\n+ **Install hax**:  `nix profile install github:hacspec/hax`, then run `cargo hax --help` anywhere\n+ **Note**: in any of the Nix commands above, replace `github:hacspec/hax` by `./dir` to compile a local checkout of hax that lives in `./some-dir`\n+ **Setup binary cache**: [using Cachix](https://app.cachix.org/cache/hax), just `cachix use hax`\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eUsing Docker\u003c/b\u003e\u003c/summary\u003e\n\n1. Clone this repo: `git clone git@github.com:hacspec/hax.git \u0026\u0026 cd hax`\n3. Build the docker image: `docker build -f .docker/Dockerfile . -t hax`\n4. Get a shell: `docker run -it --rm -v /some/dir/with/a/crate:/work hax bash`\n5. You can now run `cargo-hax --help` (notice here we use `cargo-hax` instead of `cargo hax`)\n\nNote: Please make sure that `$HOME/.cargo/bin` is in your `$PATH`, as\nthat is where `setup.sh` will install hax.\n\n\u003c/details\u003e\n\n## Supported Subset of the Rust Language\n\nHax intends to support full Rust, with the one exception, promoting a functional style: mutable references (aka `\u0026mut T`) on return types or when aliasing (see https://github.com/hacspec/hax/issues/420) are forbidden.\n\nEach unsupported Rust feature is documented as an issue labeled [`unsupported-rust`](https://github.com/hacspec/hax/issues?q=is%3Aissue+is%3Aopen+label%3Aunsupported-rust). When the issue is labeled [`wontfix-v1`](https://github.com/hacspec/hax/issues?q=is%3Aissue+is%3Aopen+label%3Aunsupported-rust+label%3Awontfix%2Cwontfix-v1), that means we don't plan on supporting that feature soon.\n\nQuicklinks:\n - [🔨 Rejected rust we want to support](https://github.com/hacspec/hax/issues?q=is%3Aissue+is%3Aopen+label%3Aunsupported-rust+-label%3Awontfix%2Cwontfix-v1);\n - [💭 Rejected rust we don't plan to support in v1](https://github.com/hacspec/hax/issues?q=is%3Aissue+is%3Aopen+label%3Aunsupported-rust+label%3Awontfix%2Cwontfix-v1).\n\n## Hacking on Hax\nThe documentation of the internal crate of hax and its engine can be\nfound [here for the engine](https://hax.cryspen.com/engine/index.html)\nand [here for the frontend](https://hax.cryspen.com/frontend/index.html).\n\n### Edit the sources (Nix)\n\nJust clone \u0026 `cd` into the repo, then run `nix develop .`.\nYou can also just use [direnv](https://github.com/nix-community/nix-direnv), with [editor integration](https://github.com/direnv/direnv/wiki#editor-integration).\n\n### Structure of this repository\n\n- `rust-frontend/`: Rust library that hooks in the rust compiler and\n  extract its internal typed abstract syntax tree\n  [**THIR**](https://rustc-dev-guide.rust-lang.org/thir.html) as JSON.\n- `engine/`: the simplification and elaboration engine that translates programs\n  from the Rust language to various backends (see `engine/backends/`). Written\n  in OCaml.\n- `rust-engine/`: an on-going rewrite of our engine from OCaml to Rust.\n- `cli/`: the `hax` subcommand for Cargo.\n\n### Compiling, formatting, and more\nWe use the [`just` command runner](https://just.systems/). If you use\nNix, the dev shell provides it automatically, if you don't use Nix,\nplease [install `just`](https://just.systems/man/en/packages.html) on\nyour system.\n\nAnywhere within the repository, you can build and install in PATH (1)\nthe Rust parts with `just rust`, (2) the OCaml parts with `just ocaml`\nor (3) both with `just build`. More commands (e.g. `just fmt` to\nformat) are available, please run `just` or `just --list` to get all\nthe commands.\n\n## Publications \u0026 Other material\n\n* [📕 Tech report](https://hal.inria.fr/hal-03176482)\n* [📕 HACSpec: A gateway to high-assurance cryptography](https://github.com/hacspec/hacspec/blob/master/rwc2023-abstract.pdf)\n* [📕 Original hacspec paper](https://www.franziskuskiefer.de/publications/hacspec-ssr18-paper.pdf)\n\n### Secondary literature, using hacspec:\n* [📕 Last yard](https://eprint.iacr.org/2023/185)\n* [📕 A Verified Pipeline from a Specification Language to Optimized, Safe Rust](https://github.com/hacspec/hacspec.github.io/blob/master/coqpl22-final61.pdf) at [CoqPL'22](https://popl22.sigplan.org/details/CoqPL-2022-papers/5/A-Verified-Pipeline-from-a-Specification-Language-to-Optimized-Safe-Rust)\n* [📕 Hax - Enabling High Assurance Cryptographic Software](https://github.com/hacspec/hacspec.github.io/blob/master/RustVerify24.pdf) at [RustVerify24](https://sites.google.com/view/rustverify2024)\n* [📕 A formal security analysis of Blockchain voting](https://github.com/hacspec/hacspec.github.io/blob/master/coqpl24-paper8-2.pdf) at [CoqPL'24](https://popl24.sigplan.org/details/CoqPL-2024-papers/8/A-formal-security-analysis-of-Blockchain-voting)\n* [📕 Specifying Smart Contract with Hax and ConCert](https://github.com/hacspec/hacspec.github.io/blob/master/coqpl24-paper9-13.pdf) at [CoqPL'24](https://popl24.sigplan.org/details/CoqPL-2024-papers/9/Specifying-Smart-Contract-with-Hax-and-ConCert)\n\n## Contributing\n\nBefore starting any work please join the [Zulip chat][chat-link], start a [discussion on Github](https://github.com/hacspec/hax/discussions), or file an [issue](https://github.com/hacspec/hax/issues) to discuss your contribution.\n\n\n[chat-link]: https://hacspec.zulipchat.com\n\n## Acknowledgements\n\n[Zulip] graciously provides the hacspec \u0026 hax community with a \"Zulip Cloud Standard\" tier.\n\n\n[Zulip]: https://zulip.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryspen%2Fhax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcryspen%2Fhax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryspen%2Fhax/lists"}