arnaucube / babyjubjub-rs

BabyJubJub elliptic curve implementation and EdDSA signature scheme in Rust
Apache License 2.0
41 stars 17 forks source link

Feature/opt #1

Closed arnaucube closed 4 years ago

arnaucube commented 4 years ago

Add ff for internal finite field operations, and add add-2008-bbjlp for point addition.

Benchmarks (On a Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz, with 32 GB of RAM):

- before:
add               time:   [53.447 us 53.467 us 53.492 us]
mul_scalar        time:   [121.19 ms 121.22 ms 121.25 ms]
sign              time:   [383.01 ms 384.46 ms 385.98 ms]
verify            time:   [250.56 ms 251.46 ms 252.43 ms]

- current:
add               time:   [317.34 ns 317.44 ns 317.54 ns]
mul_scalar        time:   [131.05 us 131.28 us 131.58 us]
sign              time:   [973.38 us 973.83 us 974.41 us]
verify            time:   [835.34 us 839.94 us 845.29 us]

add: 168x improvement mul_scalar: 923x improvement sign: 394x improvement verify: 300x improvement

Still needs a refactor.