Orange

A pre-alpha mathematical language for cryptography. The compiler checks and evaluates a typed fragment; it does not generate native code or check proofs.

Current state
Pre-alpha
Discipline
Cryptography · Languages
Built with
Rust / Orange / Cargo / Python

The idea

Orange is a language for writing a cryptographic specification so a compiler can check it. The aim is one language for the mathematics, an implementation, narrowly worded claims, and evidence that can be replayed. What runs today is a compiler for a typed fragment of that language.

How it works

The compiler is a Rust workspace with no third-party crates. It lexes source, parses an editioned grammar, checks types, lowers a typed specification to a Typed Reference Core, and evaluates that core deterministically. orangec --version reports implemented slice S3u. The accepted semantic slice is S3a, typed literals; later S3 specifications are implemented and in review. Typed impl bodies, and refinement of an implementation against a specification, are not built.

What’s implemented

  • orangec check lexes, parses, and type-checks Orange 2026 source. orangec lex, orangec fmt, and orangec doc print tokens, a formatted source, or an offline HTML listing.
  • orangec eval reference-evaluates typed spec functions over mathematical integers, fixed-width words, modular values, arrays, bounded loops, and modules. orangec test runs known-answer tests written beside those functions.
  • orangec analyze computes exact cryptanalytic properties of one checked function at every input, and can read a linear layer or bound trails in a small substitution-permutation network. The numbers describe that function as written. They are not a security claim.
  • Standards fixtures and the algorithms directory are reference specifications. Compiler tests and algorithms/verify.py check them against published vectors. They are not native code, and they are not the roadmap's cryptography corpus.
  • orangec replay evaluates one function on a local witness file. orangec enc and orangec dec seal and open a file with an authenticated cipher written in Orange. The evaluator is not constant-time, nothing is verified, and keys are stored unencrypted.

Where it stands

Pre-alpha language

  • Proof checking, claim reports, evidence bundles, code generation, native targets, and a C ABI are not built.
  • Nothing in the repository has been independently reviewed or formally verified. Owner review is not independent review, and passing tests show only that the implemented slice behaved as tested.
  • A reference evaluation does not establish constant-time behavior or cryptographic security.
  • No outbound license has been chosen, so the repository grants no right to use, copy, or redistribute.

How to try it

These commands are copied from the Orange README. Rust 1.96.1 is pinned in rust-toolchain.toml. The compiler has no third-party dependencies. The repository gate runs on Linux 6.2 or newer.

git clone https://github.com/chasebryan/orange.git
cd orange

# Build and try the compiler
cargo run --manifest-path compiler/Cargo.toml -p orangec -- test compiler/fixtures/s3q/valid-rfc8439-tests.or
cargo run --manifest-path compiler/Cargo.toml -p orangec -- test compiler/fixtures/s3r/valid-sha3.or
cargo run --manifest-path compiler/Cargo.toml -p orangec -- eval compiler/fixtures/s3i/valid-x25519.or
cargo run --manifest-path compiler/Cargo.toml -p orangec -- eval --stats compiler/fixtures/s3p/valid-rfc8439.or
cargo run --manifest-path compiler/Cargo.toml -p orangec -- eval compiler/fixtures/s3h/valid-vectors.or
cargo run --manifest-path compiler/Cargo.toml -p orangec -- eval compiler/fixtures/s3g/valid-aes128.or
cargo run --manifest-path compiler/Cargo.toml -p orangec -- eval compiler/fixtures/s3b/valid-sha256-functions.or
cargo run --manifest-path compiler/Cargo.toml -p orangec -- check compiler/fixtures/hello.or
cargo run --manifest-path compiler/Cargo.toml -p orangec -- lex compiler/fixtures/hello.or
cargo run --manifest-path compiler/Cargo.toml -p orangec -- fmt compiler/fixtures/hello.or
cargo run --manifest-path compiler/Cargo.toml -p orangec -- doc compiler/fixtures/hello.or

# Run the compiler test suite
cargo test --manifest-path compiler/Cargo.toml --workspace

# Run the local repository gate: policy checks and sandboxed compiler checks
scripts/ci/check-repository

S0 through S2 are done. S3 is in progress. S4 through S8 and 1.0 are open. orangec --version reports implemented slice S3u. Three of ten gates are closed, counting finished stages, not time.

Roadmap

Source & resources

Documentation behind this project page

Checked 9 October 2026 against orange main 94c2fda3b26c41a707272468dd59054695d882ed. Compiler tests were not re-run.

Return home