bicycl-rs 0.1.0

Safe Rust wrapper for BICYCL C API
Documentation
  • Coverage
  • 55.76%
    92 out of 165 items documented4 out of 133 items with examples
  • Size
  • Source code size: 146.1 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 16.34 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 21s Average build duration of successful builds.
  • all releases: 21s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Jiangjiang-jiang/bicycl-rs
    0 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Jiangjiang-jiang

bicycl-rs

Safe Rust bindings for the BICYCL cryptographic library. All wrapper types are !Send + !Sync since the underlying C library is not thread-safe.

Requirements

  • CMake >= 3.16
  • GMP: libgmp-dev, gmp-devel
  • OpenSSL: libssl-dev, openssl-devel
  • A C++11-capable compiler

Usage

[dependencies]
bicycl-rs = "0.1"
use bicycl_rs::{Context, Error};

fn main() -> Result<(), Error> {
    let ctx = Context::new()?;
    let mut rng = ctx.randgen_from_seed_decimal("12345")?;
    let paillier = ctx.paillier(512)?;
    let (sk, pk) = paillier.keygen(&ctx, &mut rng)?;
    let ct = paillier.encrypt_decimal(&ctx, &pk, &mut rng, "42")?;
    let plain = paillier.decrypt_decimal(&ctx, &pk, &sk, &ct)?;
    assert_eq!(plain, "42");
    Ok(())
}

License

GPL-3.0-or-later.