zkp-primefield

Crates.iozkp-primefield
lib.rszkp-primefield
version0.2.0
sourcesrc
created_at2019-10-07 04:21:33.499035
updated_at2020-10-19 21:26:56.973418
descriptionA 251-bit prime field suitable for FFTs.
homepage
repositoryhttps://github.com/0xProject/starkcrypto/tree/master/algebra/primefield
max_upload_size
id170500
size261,865
Remco Bloemen (recmo)

documentation

README

OpenZKP Prime Field

Crates.io CircleCI Codecov

A 251-bit prime field suitable for FFTs.

Goals

  • Perfomance optimized for Native and WebAssembly
  • Generality
  • Later: Constant-time operations.
  • Prefer const fn over procedural macros.

For optimization, there are a few different scenarios:

Note: The modulus is always assumed to be 256bit or less.

  • Programmer time known fields. The programmer can supply hand tuned optimized implementations of various algorithms. Ideally well performing defaults are provided.
  • Compiler time known fields. The compiler can compute constants, for example for Montgomery representation. The field parameters should be inlined.
  • Statically runtime known fields. Modulus is not known during compilation (but it's size is). Element membership of a particular field is known at compile time. The field parameters should statically allocated and the pointers inlined.
  • Dynamically runtime known fields. Modulus is not known during compilation (but its size is). Element membership of a particular field is not known at compile time. The field element should carry a pointer to the field parameters.

Benchmark

Checkout master branch:

cargo bench --bench benchmark -- --save-baseline master
cargo bench --bench benchmark -- --baseline master
open target/criterion/report/index.html

Benchmarking using Mac OS' instrumentation. For this we need the cargo-instruments plugin for Cargo.

cargo install cargo-instruments

You can then run tests under profiling. It is recommended to filter for a specific test.

cargo instruments --release --bench benchmark --open [test name]
instruments -t "Time Profiler"  target/release/deps/benchmark-c7230d017f7da1a3 --bench cache

References and benchmarks

References

Commit count: 0

cargo fmt