14 releases

0.0.22 Nov 5, 2023
0.0.21 Oct 5, 2023
0.0.20 Sep 28, 2023
0.0.12 Aug 22, 2023
0.0.11 Jul 31, 2023

#34 in #zkp

Download history 53/week @ 2024-06-18 45/week @ 2024-06-25 95/week @ 2024-07-02 31/week @ 2024-07-09 52/week @ 2024-07-16 60/week @ 2024-07-23 51/week @ 2024-07-30 44/week @ 2024-08-06 36/week @ 2024-08-13 29/week @ 2024-08-20 62/week @ 2024-08-27 42/week @ 2024-09-03 44/week @ 2024-09-10 46/week @ 2024-09-17 119/week @ 2024-09-24 47/week @ 2024-10-01

267 downloads per month
Used in 8 crates

Apache-2.0

180KB
4.5K SLoC

ZkStd

CI crates.io badge Documentation GitHub license codecov dependency status

This crate provides basic cryptographic implementation as in Field, Curve and Pairing, Fft, Kzg, and also supports fully no_std and parity-scale-codec.

Design

Cryptography libraries need to be applied optimization easily because computation cost affects users waiting time and on-chain gas cost. We design this library following two perspectives.

  • The simplicity to replace with the latest algorithm
  • The brevity of code by avoiding duplication

We divide arithmetic operation and interface. Arithmetic operation is concrete logic as in elliptic curve addition and so on, and the interface is trait cryptography primitive supports. And we combine them with macro. With this design, we can keep the finite field and elliptic curve implementation simple.

Directory Structure

  • arithmetic: the arithmetic operation of limbs, points and bit operation.
  • behave: the interface of cryptography components as in Fft Field, Pairing Field and so on.
  • dress: the macro used for implementation and in charge of combing arithmetic and behave together.

Dependencies

~2.6–3.5MB
~70K SLoC