Crate scicrypt[][src]

Expand description

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 a run time comparison (in milliseconds) for safe prime generation:

Crate | Number of bits128192256320384
glass_pumpkin 52.160157.70319.03772.411328.3
scicrypt12.60953.627150.05321.11468.07

Updated: 10 Aug 2021 by GitHub Actions

Upcoming features

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

Version 0.4.0 (~Week 36)

Ease of use update

FunctionalityDone
Encoding signed ints
Discrete log lookup tables
Debugging tools

Version 0.3.0 (~Week 34)

Oblivious transfer update

FunctionalityDone
OT & extensions
OPRF
OPPRF

Version 0.2.0 (released)

Threshold homomorphic cryptosystems update

FunctionalityDone
Threshold Paillierx
Threshold ElGamalx
Transparent ciphertexts for debugging-

Version 0.1.0 (released)

Homomorphic cryptosystems update

FunctionalityDone
ElGamal over elliptic curvesx
ElGamal over the integersx
Paillierx
RSAx

Modules

Partially homomorphic cryptosystems with one key.

Functions for generating random prime numbers.

Random number generation that is consistent with the dependencies’ requirements.

Partially homomorphic threshold cryptosystems that require multiple parties to decrypt.

Structs

General error that arises when decryption fails, for example because there were not enough distinct decryption shares to decrypt a threshold ciphertext.

Rich representation of a ciphertext that associates it with the corresponding public key. This allows for performing homomorphic operations using operator overloading, among others.

Traits

An asymmetric cryptosystem is a system of methods to encrypt plaintexts into ciphertexts, and decrypt those ciphertexts back into plaintexts. Anyone who has access to the public key can perform encryptions, but only those with the secret key can decrypt.

An asymmetric threshold cryptosystem is a system of methods to encrypt plaintexts into ciphertexts, but instead of having a single secret key to decrypt them back into plaintexts, we require a given number of parties to decrypt with their own partial key. If enough parties partially decrypt, the resulting shares can be combined into the original plaintext. Still, anyone who has access to the public key can perform encryptions.

Some cryptosystems do not require the public key to decrypt, as all the necessary information is stored within the ciphertext and the secret key. For example, ElGamal when its group is hard-coded.

Functionality to easily turn a ciphertext into a rich ciphertext