fastcrypto

crate Docs Build status Apache2/MIT licensed Rust Version

fastcrypto is a common cryptography library used in software at Mysten Labs. It is published as an independent crate to encourage reusability across different applications and domains. It is a wrapper library around several carefully selected crates with the following considerations:

Furthermore, we extend the selected libraries with additional features: - Robust testing framework: Wycheproof tests and prop tests are added when possible to protect against arbitrary inputs and crafted edge cases. - Zeroization: Sensitive private key materials are cleared from memory securely and proactively when it goes out of scope using zeroize trait. - Serialization: Effective and standardized serialization are required.

This library will be continuously updated with more schemes and faster implementations based on benchmarking results, RFC updates, new research and auditor inputs.

This crate contains:

There exist tests for all the three schemes, which can be run by:
$ cargo test

Benchmarks

One can compare all currently implemented schemes for sign, verify, verify_batch and key-generation by running: $ cargo bench A report of the benchmarks is generated for each release, allowing easy comparison of the performance of the different cryptographic primitives and schemes available in fastcrypto. As an example, we get these timings for signing messages and verifying the signature for the different schemes in fastcrypto as of revision dbf2ea4:

| Scheme | Sign | Verify | | ---------------- | ---------- | ---------- | | Ed25519 | 20.556 μs | 57.110 μs | | BLS12377 | 581.66 μs | 2525.4 μs | | BLS12381 minsig | 167.69 μs | 1013.6 μs | | BLS12381 minpk | 410.96 μs | 1143.3 μs | | Secp256k1 | 102.06 μs | 47.641 μs |

Below is a plot from the report, showing benchmarks for batched signature verification where all signatures are on the same message: Batched signature verification with all signatures on same message.

License

All crates licensed under either of