[−][src]Trait amcl_wrapper_ml::group_elem::GroupElement
Required methods
fn new() -> Self
fn identity() -> Self
Return the identity element
fn generator() -> Self
Return a group 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
Please use hash_to_curve
instead
Hash an arbitrary sized message using SHAKE and return output as group element
fn hash_to_curve(msg: &[u8], dst: &DomainSeparationTag) -> Self
Uses IETF constant time hash_to_curve method to map data to a point
fn to_bytes(&self) -> Vec<u8>
Return byte representation as vector
fn from_bytes(bytes: &[u8]) -> Result<Self, SerzDeserzError>
Create an element from a byte representation
fn write_to_slice(&self, target: &mut [u8]) -> Result<(), SerzDeserzError>
Writes bytes to given slice. Raises exception when given slice is not of desired length.
fn write_to_slice_unchecked(&self, target: &mut [u8])
Writes bytes to given slice. Will panic when given slice is not of desired length.
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?
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
Implementors
impl GroupElement for G1
[src]
fn new() -> Self
[src]
fn identity() -> Self
[src]
fn generator() -> Self
[src]
This is an arbitrary choice. Any group element can be a generator
fn is_identity(&self) -> bool
[src]
fn set_to_identity(&mut self)
[src]
fn from_msg_hash(msg: &[u8]) -> Self
[src]
fn hash_to_curve(msg: &[u8], dst: &DomainSeparationTag) -> Self
[src]
fn to_bytes(&self) -> Vec<u8>
[src]
fn from_bytes(bytes: &[u8]) -> Result<Self, SerzDeserzError>
[src]
fn write_to_slice(&self, target: &mut [u8]) -> Result<(), SerzDeserzError>
[src]
fn write_to_slice_unchecked(&self, target: &mut [u8])
[src]
fn add_assign_(&mut self, b: &Self)
[src]
fn sub_assign_(&mut self, b: &Self)
[src]
fn plus(&self, b: &Self) -> Self
[src]
fn minus(&self, b: &Self) -> Self
[src]
fn scalar_mul_const_time(&self, a: &FieldElement) -> Self
[src]
fn double(&self) -> Self
[src]
fn double_mut(&mut self)
[src]
fn to_hex(&self) -> String
[src]
fn from_hex(s: String) -> Result<Self, SerzDeserzError>
[src]
fn negation(&self) -> Self
[src]
fn is_extension() -> bool
[src]
fn has_correct_order(&self) -> bool
[src]
impl GroupElement for G2
[src]
fn new() -> Self
[src]
fn identity() -> Self
[src]
fn generator() -> Self
[src]
This is an arbitrary choice. Any group element can be a generator
fn is_identity(&self) -> bool
[src]
fn set_to_identity(&mut self)
[src]
fn from_msg_hash(msg: &[u8]) -> Self
[src]
fn hash_to_curve(_msg: &[u8], _dst: &DomainSeparationTag) -> Self
[src]
TODO: call the appropriate function once implemented in hash2curve
crate