[−][src]Trait amcl_wrapper::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
Hash an arbitrary sized message using SHAKE and return output as group element
fn to_bytes(&self, compress: bool) -> Vec<u8>
Return byte representation as vector. If compress
is true, compresses the point before
serializing to bytes.
fn from_bytes(bytes: &[u8]) -> Result<Self, SerzDeserzError>
Create an element from a byte representation. Handles both compressed as well as uncompressed
fn write_to_slice(
&self,
target: &mut [u8],
compress: bool
) -> Result<(), SerzDeserzError>
&self,
target: &mut [u8],
compress: bool
) -> Result<(), SerzDeserzError>
Writes bytes to given slice. If compress
is true, compresses the point before serializing
to bytes. Raises exception when given slice is not of desired length.
fn write_to_slice_unchecked(&self, target: &mut [u8], compress: bool)
Writes bytes to given slice. If compress
is true, compresses the point before serializing
to bytes. 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 or FP2s enclosed by parenthesis. 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 to_bytes(&self, compress: bool) -> Vec<u8>
[src]
fn from_bytes(bytes: &[u8]) -> Result<Self, SerzDeserzError>
[src]
fn write_to_slice(
&self,
target: &mut [u8],
compress: bool
) -> Result<(), SerzDeserzError>
[src]
&self,
target: &mut [u8],
compress: bool
) -> Result<(), SerzDeserzError>
fn write_to_slice_unchecked(&self, target: &mut [u8], compress: bool)
[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]
Returns the string infinity
if the element corresponds to a point at infinity
Returns (x)
or (x,y)
depending on the curve being a Montgomery curve or not.
x
and y
are hex representations of FP
fn from_hex(string: 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 to_bytes(&self, compress: bool) -> Vec<u8>
[src]
fn from_bytes(bytes: &[u8]) -> Result<Self, SerzDeserzError>
[src]
fn write_to_slice(
&self,
target: &mut [u8],
compress: bool
) -> Result<(), SerzDeserzError>
[src]
&self,
target: &mut [u8],
compress: bool
) -> Result<(), SerzDeserzError>
fn write_to_slice_unchecked(&self, target: &mut [u8], compress: bool)
[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]
Returns the string infinity
if the element corresponds to a point at infinity
Returns (x,y)
where both x
and y
are hex representations of FP2