#multi-party #building-block #concepts #computation #proof #multiparty-computation

scicrypt

Lightweight cryptographic building blocks for proof of concept implementations in multi-party computation

14 releases (7 breaking)

0.7.1 Sep 14, 2022
0.6.2 Sep 8, 2022
0.6.0 May 6, 2022
0.5.0 Feb 28, 2022
0.1.0 Jul 11, 2021

#720 in Cryptography

39 downloads per month

MIT and LGPL-3.0+

185KB
3.5K SLoC

WARNING: WHILE THIS LIBRARY MAKES SOME EFFORT FOR SECURE IMPLEMENTATIONS, IT SHOULD NOT BE USED FOR ANY PRACTICAL APPLICATIONS. THE CODE IS NOT AUDITED. WE MAKE NO GUARANTEES ABOUT THE CODE'S CORRECTNESS NOR SECURITY.

Lightweight cryptographic building blocks for proof of concept implementations in applied cryptography.

While many libraries implementing cryptographic building blocks exist, many fall in one of two categories:

  • Fast but rigid, like many written in C++
  • Slow but flexible, like many written in python

This library attempts to find a balance between speed and flexibility, to ease the process of implementing proof of concepts of cryptographic protocols, such as those in the field of multi- party computation (MPC).

Current features

Currently, the library implements the following homomorphic cryptosystems and the associated homomorphic operations:

  • ElGamal over Curve25519 (Ristretto-encoded) and two threshold versions
  • ElGamal over safe prime groups and two threshold versions
  • Paillier and threshold Paillier
  • RSA

In addition, the library implements safe prime generation, which is faster than the same functionality implemented in other crates. The code is benchmarked between every version to ensure we do not increase run time and to compare against other implementations.

Check the table below for an average run time comparison (in milliseconds) for safe prime generation:

Crate | Number of bits128192256320384
glass_pumpkin52.51704026521530
openssl3.9511.121.953.679.8
scicrypt2.207.0220.137.572.5

Updated: 31 Mar 2022 from GitHub Actions

You can run this benchmark yourself by executing cargo bench --bench prime_gen. By default, this benchmark is turned off because it can take up to 15 minutes to run. In other words, it will not run when you simply run cargo bench. Note that on my personal laptop, OpenSSL slightly outperforms scicrypt on average, so results can differ based on hardware.

Upcoming features

These are the upcoming minor versions and the functionality they will add.

Ease of use update

FunctionalityDone
Encoding signed ints
Discrete log lookup tables
Debugging tools

Secret sharing update

FunctionalityDone
Additive secret sharing
Multiplicative secret sharing
Shamir's secret sharing

Oblivious transfer update

FunctionalityDone
OT & extensions
OPRF
OPPRF

RLWE-based encryption

FunctionalityDone
Polynomial arithmetic
BGV (no bootstrapping)

Dependencies

~23MB
~548K SLoC