hacspec
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
- AES 128/256
- GF 128
- AES-GCM 128/256
- Blake2b
- Curve25519
- Fips202
- SHA256
- HKDF-SHA256
- HMAC-SHA256
- P256
- NTRU-prime
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.