[][src]Trait accumulator::group::Group

pub trait Group: Clone + Debug + Eq + Hash + TypeRep + Send + Sync {
    type Elem: Clone + Debug + Eq + Hash + Sized + Send + Sync;
    fn id_(rep: &Self::Rep) -> Self::Elem;
fn op_(rep: &Self::Rep, a: &Self::Elem, b: &Self::Elem) -> Self::Elem;
fn inv_(rep: &Self::Rep, a: &Self::Elem) -> Self::Elem; fn exp_(_rep: &Self::Rep, a: &Self::Elem, n: &Integer) -> Self::Elem { ... }
fn id() -> Self::Elem { ... }
fn op(a: &Self::Elem, b: &Self::Elem) -> Self::Elem { ... }
fn exp(a: &Self::Elem, n: &Integer) -> Self::Elem { ... }
fn inv(a: &Self::Elem) -> Self::Elem { ... } }

A mathematical group.

This trait allows the implementation of standard group routines:

The TypeRep trait lets us emulate type-level static fields, e.g. the modulus in an RSA group or the discriminant in a class group.

Clients of this trait need to implement functions of the form *_, which take in TypeRep data as a parameter. Consumers use functions without the underscore: id, op, exp, and inv.

Associated Types

type Elem: Clone + Debug + Eq + Hash + Sized + Send + Sync

The associated group element type for this group.

Loading content...

Required methods

fn id_(rep: &Self::Rep) -> Self::Elem

A group-specific wrapper for id.

fn op_(rep: &Self::Rep, a: &Self::Elem, b: &Self::Elem) -> Self::Elem

A group-specific wrapper for op.

fn inv_(rep: &Self::Rep, a: &Self::Elem) -> Self::Elem

A group-specific wrapper for inv.

Loading content...

Provided methods

fn exp_(_rep: &Self::Rep, a: &Self::Elem, n: &Integer) -> Self::Elem

A group-specific wrapper for exp, although it comes with a default implementation via repeated squaring.

Specific implementations may provide more performant specializations as needed (e.g. Montgomery multiplication for RSA groups).

fn id() -> Self::Elem

Returns the identity element of the group.

fn op(a: &Self::Elem, b: &Self::Elem) -> Self::Elem

Applies the group operation to elements a and b and returns the result.

fn exp(a: &Self::Elem, n: &Integer) -> Self::Elem

Applies the group operation to a and itself n times and returns the result.

fn inv(a: &Self::Elem) -> Self::Elem

Returns the group inverse of a.

Loading content...

Implementors

impl Group for ClassGroup[src]

type Elem = ClassElem

fn id() -> Self::Elem[src]

fn op(a: &Self::Elem, b: &Self::Elem) -> Self::Elem[src]

fn exp(a: &Self::Elem, n: &Integer) -> Self::Elem[src]

fn inv(a: &Self::Elem) -> Self::Elem[src]

impl Group for Ristretto[src]

type Elem = RistrettoElem

fn id() -> Self::Elem[src]

fn op(a: &Self::Elem, b: &Self::Elem) -> Self::Elem[src]

fn exp(a: &Self::Elem, n: &Integer) -> Self::Elem[src]

fn inv(a: &Self::Elem) -> Self::Elem[src]

impl Group for Rsa2048[src]

type Elem = Rsa2048Elem

fn id() -> Self::Elem[src]

fn op(a: &Self::Elem, b: &Self::Elem) -> Self::Elem[src]

fn exp(a: &Self::Elem, n: &Integer) -> Self::Elem[src]

fn inv(a: &Self::Elem) -> Self::Elem[src]

Loading content...