1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(non_snake_case)]

//! Dynamic Positive and Universal accumulators according to the paper: "Dynamic Universal Accumulator with Batch Update over Bilinear Groups" <https://eprint.iacr.org/2020/777>
//! Provides a dynamic positive accumulator [`PositiveAccumulator`], that supports membership proofs
//! Provides a dynamic universal accumulator [`UniversalAccumulator`], that supports membership and non-membership proofs
//! Provides a zero knowledge proof of membership and non-membership in the accumulators with [`ProofProtocol`].
//! The implementation tries to use the same variable names as the paper and thus violate Rust's naming conventions at places.
//!
//! [`PositiveAccumulator`]: crate::positive::PositiveAccumulator
//! [`UniversalAccumulator`]: crate::universal::UniversalAccumulator
//! [`ProofProtocol`]: crate::proofs::ProofProtocol

#[cfg(feature = "parallel")]
use rayon::prelude::*;

pub mod batch_utils;
pub mod error;
pub mod persistence;
pub mod positive;
pub mod proofs;
pub mod setup;
pub mod universal;
pub mod utils;
pub mod witness;

#[cfg(test)]
#[macro_use]
pub mod tests {
    #[macro_export]
    macro_rules! test_serialization {
        ($obj_type:ident, $obj: expr) => {
            let mut serz = vec![];
            $obj.serialize(&mut serz).unwrap();
            assert_eq!($obj_type::deserialize(&serz[..]).unwrap(), $obj);

            let mut serz = vec![];
            $obj.serialize_unchecked(&mut serz).unwrap();
            assert_eq!($obj_type::deserialize_unchecked(&serz[..]).unwrap(), $obj);

            let mut serz = vec![];
            $obj.serialize_uncompressed(&mut serz).unwrap();
            assert_eq!(
                $obj_type::deserialize_uncompressed(&serz[..]).unwrap(),
                $obj
            );
        };
    }
}