Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add accumulators #300

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ members = [
"did-webkey",
"vc-test",
"did-test",
"accumulator-common",
"accumulator-rsa",
"accumulator-ecc",
"pairings",
]

[dev-dependencies]
Expand Down
35 changes: 35 additions & 0 deletions accumulator-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
authors = ["Michael Lodder <[email protected]>"]
categories = ["cryptography", "rsa"]
description = "Cryptographic Accumulator common structs and methods"
edition = "2018"
license = "Apache-2.0"
name = "accumulator-common"
repository = "https://github.com/spruceid/ssi"
version = "0.1.0"

[features]
default = ["bi-rust"]
bi-rust = ["glass_pumpkin", "num-bigint", "num-traits", "num-integer", "rand"]
bi-ossl = ["openssl"]
bi-gmp = ["hex", "rust-gmp"]

[dependencies]
failure = "0.1"
hex = { version = "0.4", optional = true }
glass_pumpkin = { version = "1", optional = true }
num-bigint = { version = "0.4", features = ["rand"], optional = true }
num-traits = { version = "0.2", optional = true }
num-integer = { version = "0.1", optional = true }
openssl = { version = "0.10", optional = true }
rand = { version = "0.8", optional = true }
rust-gmp = { version = "0.5", optional = true, git = "https://github.com/mikelodder7/rust-gmp" }
serde = { version = "1", features = ["serde_derive"] }
zeroize = { version = "1", features = ["zeroize_derive"] }

[dev-dependencies]
rust-gmp = { version = "0.5", git = "https://github.com/mikelodder7/rust-gmp" }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
28 changes: 28 additions & 0 deletions accumulator-common/src/bigint/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/// Use Big Integer implementation backed by OpenSSL BigNum
#[cfg(feature = "openssl")]
pub mod ossl;
/// Use Big Integer implementation backed by GMP Mpz
#[cfg(feature = "rust-gmp")]
pub mod mpz;
/// Use Big Integer implementation backed by rust's num-bigint
#[cfg(feature = "bi-rust")]
pub mod rust;

/// The result from running extended euclid algorithm
#[derive(Debug, Default)]
pub struct GcdResult {
/// The greatest common divisor
pub value: BigInteger,
/// Bézout coefficient `a`
pub a: BigInteger,
/// Bézout coefficient `b`
pub b: BigInteger
}

#[cfg(feature = "openssl")]
pub use ossl::OsslBigInt as BigInteger;
#[cfg(feature = "rust-gmp")]
pub use mpz::MpzBigInt as BigInteger;
#[cfg(feature = "bi-rust")]
pub use rust::RustBigInt as BigInteger;

Loading