Struct libsecp256k1_rs::PublicKey [−][src]
pub struct PublicKey(_);
Public key on a secp256k1 curve.
Methods
impl PublicKey
[src]
impl PublicKey
pub fn from_secret_key(seckey: &SecretKey) -> PublicKey
[src]
pub fn from_secret_key(seckey: &SecretKey) -> PublicKey
Create a public key from a private key by performing P = k.G
pub fn parse_compressed(p: &[u8; 33]) -> Result<PublicKey, Error>
[src]
pub fn parse_compressed(p: &[u8; 33]) -> Result<PublicKey, Error>
Create a public key from a compressed public key. Remember that Public keys are just points on the elliptic curve, so you can derive the full point by supplying the x-coordinate and the parity. By convention, compressed public keys hold the parity in the first byte and the x-coordinate in the next 32 bytes.
pub fn parse(p: &[u8; 65]) -> Result<PublicKey, Error>
[src]
pub fn parse(p: &[u8; 65]) -> Result<PublicKey, Error>
Create a PublicKey from 65-byte binary representation of a public key. The first byte is a prefix (must be 4,6, or 7). The next 32 bytes represent the x-coordinate; and the last 32 bytes represent thew y-coordinate.
pub fn serialize(&self) -> [u8; 65]
[src]
pub fn serialize(&self) -> [u8; 65]
Return the 65-bit serialization of the public key. The first byte is always 0x04 to represent an uncompressed public key.
pub fn serialize_compressed(&self) -> [u8; 33]
[src]
pub fn serialize_compressed(&self) -> [u8; 33]
Return the 33-bit serialization of the compressed public key.
Trait Implementations
impl Debug for PublicKey
[src]
impl Debug for PublicKey
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for PublicKey
[src]
impl Clone for PublicKey
fn clone(&self) -> PublicKey
[src]
fn clone(&self) -> PublicKey
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for PublicKey
[src]
impl Copy for PublicKey
impl Eq for PublicKey
[src]
impl Eq for PublicKey
impl PartialEq for PublicKey
[src]
impl PartialEq for PublicKey
fn eq(&self, other: &PublicKey) -> bool
[src]
fn eq(&self, other: &PublicKey) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &PublicKey) -> bool
[src]
fn ne(&self, other: &PublicKey) -> bool
This method tests for !=
.
impl Into<Affine> for PublicKey
[src]
impl Into<Affine> for PublicKey
impl Add for PublicKey
[src]
impl Add for PublicKey
type Output = PublicKey
The resulting type after applying the +
operator.
fn add(self, rhs: PublicKey) -> Self::Output
[src]
fn add(self, rhs: PublicKey) -> Self::Output
Performs the +
operation.
impl Sub for PublicKey
[src]
impl Sub for PublicKey
type Output = PublicKey
The resulting type after applying the -
operator.
fn sub(self, rhs: PublicKey) -> PublicKey
[src]
fn sub(self, rhs: PublicKey) -> PublicKey
Performs the -
operation.
impl Mul<PublicKey> for SecretKey
[src]
impl Mul<PublicKey> for SecretKey
type Output = PublicKey
The resulting type after applying the *
operator.
fn mul(self, rhs: PublicKey) -> PublicKey
[src]
fn mul(self, rhs: PublicKey) -> PublicKey
Performs the *
operation.
impl Combinable for PublicKey
[src]
impl Combinable for PublicKey