starkware-crypto-rs icon indicating copy to clipboard operation
starkware-crypto-rs copied to clipboard

Rust FFI bindings for StarkWare's crypto-cpp library

starkware-crypto-rs

Rust FFI bindings for StarkWare's crypto-cpp library

linting-badge tests-unix-badge tests-windows-badge crates-badge

Note that currently target x86_64-pc-windows-msvc is not supported. If you're building on Windows, you need to use the GNU build of Rust.

Using starknet-crypto instead

Due to a few known issues with this library:

  • the underlying crypto-cpp library hasn't been updated for quite a while; and

  • the library does not build on Windows with MSVC; and

  • the underlying library is relatively slow in terms of performance;

you're advised to use starknet-crypto instead, which is pure-Rust implementation of the same low-level cryptography functions, with better performance and portability.

Adding starkware-crypto-rs to your project

Still want to use starkware-crypto-rs? To use the crate from crates.io, add the following to your Cargo.toml file:

[dependencies]
starkware-crypto-sys = "0.1"

Running benchmark

To run benchmark:

$ cargo bench

On the author's machine with Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz running Ubuntu 20.04.2 LTS:

ecdsa_get_public_key    time:   [4.1132 ms 4.1567 ms 4.2157 ms]
ecdsa_sign              time:   [185.54 ms 186.31 ms 187.20 ms]
ecdsa_verify            time:   [1.5582 ms 1.5708 ms 1.5853 ms]
pedersen_hash           time:   [293.27 us 294.74 us 296.33 us]

License

Licensed under either of

  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.