#elliptic-curve #math #prime #no-alloc

no-std stark-curve

Stark curve implementation

2 releases

0.1.1 Feb 8, 2024
0.1.0 Nov 24, 2023

#1145 in Cryptography

Download history 15/week @ 2023-12-22 39/week @ 2024-01-05 81/week @ 2024-01-12 132/week @ 2024-01-19 168/week @ 2024-01-26 154/week @ 2024-02-02 178/week @ 2024-02-09 141/week @ 2024-02-16 211/week @ 2024-02-23 178/week @ 2024-03-01 188/week @ 2024-03-08 265/week @ 2024-03-15 285/week @ 2024-03-22 392/week @ 2024-03-29 202/week @ 2024-04-05

1,160 downloads per month
Used in 3 crates (via generic-ec-curves)

MIT/Apache

23KB
528 lines

License Docs Crates io

Stark Curve

Pure Rust implementation of Stark Curve. Provides basic elliptic curve arithmetic backed by primeorder, elliptic-curve, and ff crates. #![no_std] friendly.

Curve parameters

As specified in a stark curve specs, this crate provides an implementation of a curve defined by equation:

$$y^2 = x^3 + \alpha x + \beta \pmod p$$

where:

$$ \begin{aligned} \alpha &= 1\\ \beta &= 3141592653589793238462643383279502884197169399375105820974944592307816406665\\ p &= 3618502788666131213697322783095070105623107215331596699973092056135872020481\\ &= 2^{251} + 17 \cdot 2^{192} + 1 \end{aligned} $$

Also, curve order $n$, which is not mentioned in the specs but can be found here:
$n = 3618502788666131213697322783095070105526743751716087489154079457884512865583$

Both $p$ and $n$ are prime.

Security

This crate doesn't implement any sensitive cryptography code. Instead, we delegate scalar arithmetic to ff crate, and elliptic point arithmetic to primeorder crate, which are considered to be heavily used and tested.

License

Licensed under either of

  • Apache License, Version 2.0
  • MIT license

at your option.

Dependencies

~4MB
~91K SLoC