[][src]Trait amcl_wrapper::group_elem::GroupElement

pub trait GroupElement: Clone + Sized {
    fn new() -> Self;
fn identity() -> Self;
fn generator() -> Self;
fn is_identity(&self) -> bool;
fn set_to_identity(&mut self);
fn from_msg_hash(msg: &[u8]) -> Self;
fn to_bytes(&self) -> Vec<u8>;
fn from_bytes(bytes: &[u8]) -> Result<Self, SerzDeserzError>;
fn add_assign_(&mut self, b: &Self);
fn sub_assign_(&mut self, b: &Self);
fn plus(&self, b: &Self) -> Self;
fn minus(&self, b: &Self) -> Self;
fn scalar_mul_const_time(&self, a: &FieldElement) -> Self;
fn double(&self) -> Self;
fn double_mut(&mut self);
fn to_hex(&self) -> String;
fn from_hex(s: String) -> Result<Self, SerzDeserzError>;
fn negation(&self) -> Self;
fn is_extension() -> bool;
fn has_correct_order(&self) -> bool; fn random() -> Self { ... }
fn random_using_rng<R: RngCore + CryptoRng>(rng: &mut R) -> Self { ... } }

Required methods

fn new() -> Self

fn identity() -> Self

Return the identity element

fn generator() -> Self

Return the group's generator

fn is_identity(&self) -> bool

Check if the the point is the identity element of the group

fn set_to_identity(&mut self)

Set the point to the identity element of the group

fn from_msg_hash(msg: &[u8]) -> Self

Hash an arbitrary sized message using SHAKE and return output as group element

fn to_bytes(&self) -> Vec<u8>

fn from_bytes(bytes: &[u8]) -> Result<Self, SerzDeserzError>

fn add_assign_(&mut self, b: &Self)

Add a group element to itself. self = self + b

fn sub_assign_(&mut self, b: &Self)

Subtract a group element from itself. self = self - b

fn plus(&self, b: &Self) -> Self

Return sum of a group element and itself. self + b

fn minus(&self, b: &Self) -> Self

Return difference of a group element and itself. self - b

fn scalar_mul_const_time(&self, a: &FieldElement) -> Self

Multiply point on the curve (element of group G1) with a scalar. Constant time operation. self * field_element_a.

fn double(&self) -> Self

Return the double of the group element

fn double_mut(&mut self)

fn to_hex(&self) -> String

Returns hex string as a sequence of FPs separated by whitespace. Each FP is itself a 2-tuple of strings separated by whitespace, 1st string is the excess and 2nd is a BigNum

fn from_hex(s: String) -> Result<Self, SerzDeserzError>

Returns a group element by parsing the hex representation of itself. The hex representation should match the one from to_hex

fn negation(&self) -> Self

Returns negation of this element

fn is_extension() -> bool

fn has_correct_order(&self) -> bool

Checks if the element has correct order by checking if self * group order (curve order) == Identity element (point at infinity). Uses constant time scalar multiplication. Question: But since we always know the multiplicand (group order) is there a faster way?

Loading content...

Provided methods

fn random() -> Self

Return a random group element

fn random_using_rng<R: RngCore + CryptoRng>(rng: &mut R) -> Self

Return a random group element using the given random number generator

Loading content...

Implementors

impl GroupElement for G1[src]

impl GroupElement for G2[src]

Loading content...