pub struct ECVRF { /* private fields */ }Implementations§
Source§impl ECVRF
impl ECVRF
Sourcepub fn from_suite(suite: CipherSuite) -> Result<Self, Error>
pub fn from_suite(suite: CipherSuite) -> Result<Self, Error>
Sourcepub fn hash_to_try_and_increment(
&mut self,
public_key: &EcPoint,
alpha_string: &[u8],
) -> Result<EcPoint, Error>
pub fn hash_to_try_and_increment( &mut self, public_key: &EcPoint, alpha_string: &[u8], ) -> Result<EcPoint, Error>
ECVRF_hash_to_curve implementation as specified in Section 5.4.1.1 [VRF-draft-05]
§Arguments
public_key: an Elliptical Curve pointalpha_string: value to be hashed, an octet string
§Returns:
- a finite EC point in G
Sourcepub fn arbitrary_string_to_point(
&mut self,
data: &[u8],
) -> Result<EcPoint, Error>
pub fn arbitrary_string_to_point( &mut self, data: &[u8], ) -> Result<EcPoint, Error>
Converts an arbitrary string to a point in the curve as specified in Section 5.5 [VRF-draft-05]
§Arguments
data: a 32 octet string to be converted to a point
§returns an EcPoint representing the converted point if successful
Sourcepub fn generate_nonce(
&mut self,
secret_key: &BigNum,
data: &[u8],
) -> Result<BigNum, Error>
pub fn generate_nonce( &mut self, secret_key: &BigNum, data: &[u8], ) -> Result<BigNum, Error>
Generates a nonce deterministically from the algorithm specified in Section 3.2 RFC6979
§Arguments
secret key: a BigNum representing the secret key.data: a slice of octets representing the message
§Returns:
- a
BigNumrepresenting the nonce.
Sourcepub fn hash_points(&mut self, points: &[&EcPoint]) -> Result<BigNum, Error>
pub fn hash_points(&mut self, points: &[&EcPoint]) -> Result<BigNum, Error>
Hashes a slice of EC points to a BigNum integer as specified in Section 5.4.3 [VRF-draft-05]
§Arguments
points: a slice of points that need to be hashed
§Returns:
- a
BigNuminteger (0 < x < 2^(8n) - 1) representing the hash of points truncated to lengthn, if successful.
Sourcepub fn decode_proof(
&mut self,
pi_string: &[u8],
) -> Result<(EcPoint, BigNum, BigNum), Error>
pub fn decode_proof( &mut self, pi_string: &[u8], ) -> Result<(EcPoint, BigNum, BigNum), Error>
Function to decode a proof pi_string produced by EC_prove, to (gamma, c, s) as specified in
Section 5.4.4 [VRF-draft-05]
§Arguments
pi_string: a slice of octets representing the generated proof
§Returns
gamma: anEcPointc: integer between 0 and 2 ^ (8n) - 1s: integer between 0 and 2 ^ (8qlen) - 1
Trait Implementations§
Source§impl ECVRF<&[u8], &[u8]> for ECVRF
impl ECVRF<&[u8], &[u8]> for ECVRF
Source§fn prove(&mut self, pkey: &[u8], alpha_string: &[u8]) -> Result<Vec<u8>, Error>
fn prove(&mut self, pkey: &[u8], alpha_string: &[u8]) -> Result<Vec<u8>, Error>
Generates proof from a private key and a message as specified in Section 5.1 [VRF-draft-05]
§Arguments:
pkey: a private keyalpha_string: octet string message represented by a slice
§Returns:
- if successful, a vector of octets representing the proof
pi_string
Source§fn verify(
&mut self,
public_key: &[u8],
alpha_string: &[u8],
pi_string: &[u8],
) -> Result<Vec<u8>, Error>
fn verify( &mut self, public_key: &[u8], alpha_string: &[u8], pi_string: &[u8], ) -> Result<Vec<u8>, Error>
type Error = Error
Auto Trait Implementations§
impl Freeze for ECVRF
impl RefUnwindSafe for ECVRF
impl Send for ECVRF
impl Sync for ECVRF
impl Unpin for ECVRF
impl UnwindSafe for ECVRF
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more