aaqibb13 / hacspec

A specification language for cryptography primitives.

Home Page:https://hacspec.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hacspec crate Docs Build & Test Status Docs Status Maturity Level

A new specification language for crypto primitives in Rust.

This is the successor of https://github.com/HACS-workshop/hacspec.

A formal description of the hacspec language can be found in Language.md

Repository Structure

This is a cargo workspace consisting of six main crates:

  • hacspec: the compiler, typechecker and language infrastructure for the hacspec subset of Rust
  • hacspec-lib: the standard library of hacspec programs
  • abstract-integers: wrapper around BigInt for modular natural integers
  • secret-integers: wrapper around integer types for constant-timedness
  • unsafe-hacspec-examples: cryptographic specs written in hacspec but not formally typechecked yet(hence the unsafety) as hacspec is a work in progress

The examples folder contains cryptographic primitives that have passed the hacspec typechecking.

There's an additional crate hacspec-attributes that is only used in the hacspec library, and hacspec-dev which are hacspec utilities that are not part of the language.

Finally, the fstar folder contains F* translations of the cryptograpghic specs, produced by the hacspec compiler.

Examples

There's a set of example specs, divided between the safe and unsafe. To run all examples one can use cargo test.

Safe examples

Unsafe examples

The hacspec language infrastructure

The language infrastructure is excluded from the main workspace of crates, so it won't be build when you launch cargo build from the root of the repository. It is located in the language folder.

Please refer to the dedicated README.md for instructions about how to run the typechecker and compiler.

About

A specification language for cryptography primitives.

https://hacspec.org


Languages

Language:Rust 87.3%Language:TeX 5.2%Language:eC 2.9%Language:F* 2.7%Language:Python 1.4%Language:Makefile 0.4%Language:Shell 0.1%