Struct libsecp256k1_rs::PublicKey [−][src]
pub struct PublicKey(_);
Public key on a secp256k1 curve.
Methods
impl PublicKey[src]
impl PublicKeypub fn from_secret_key(seckey: &SecretKey) -> PublicKey[src]
pub fn from_secret_key(seckey: &SecretKey) -> PublicKeyCreate a public key from a private key by performing P = k.G
pub fn from_hex(h: &str) -> Result<PublicKey, Error>[src]
pub fn from_hex(h: &str) -> Result<PublicKey, Error>Generate a public key from hex The expected format is a tag (0x04, 0x06 or 0x07) for uncompressed keys, 0x02, 0x03 for compressed keys followed by 32 or 64 bytes, depending on whether the key is compressed or not
pub fn to_hex(&self, compressed: bool) -> String[src]
pub fn to_hex(&self, compressed: bool) -> StringReturn the hexadecimal representation of the public key
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 PublicKeyfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Clone for PublicKey[src]
impl Clone for PublicKeyfn clone(&self) -> PublicKey[src]
fn clone(&self) -> PublicKeyReturns 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 PublicKeyimpl Eq for PublicKey[src]
impl Eq for PublicKeyimpl PartialEq for PublicKey[src]
impl PartialEq for PublicKeyfn eq(&self, other: &PublicKey) -> bool[src]
fn eq(&self, other: &PublicKey) -> boolThis 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) -> boolThis method tests for !=.
impl Display for PublicKey[src]
impl Display for PublicKeyfn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>Formats the value using the given formatter. Read more
impl Into<Affine> for PublicKey[src]
impl Into<Affine> for PublicKeyimpl Add for PublicKey[src]
impl Add for PublicKeytype Output = PublicKey
The resulting type after applying the + operator.
fn add(self, rhs: PublicKey) -> Self::Output[src]
fn add(self, rhs: PublicKey) -> Self::OutputPerforms the + operation.
impl Sub for PublicKey[src]
impl Sub for PublicKeytype Output = PublicKey
The resulting type after applying the - operator.
fn sub(self, rhs: PublicKey) -> PublicKey[src]
fn sub(self, rhs: PublicKey) -> PublicKeyPerforms the - operation.
impl Mul<PublicKey> for SecretKey[src]
impl Mul<PublicKey> for SecretKeytype Output = PublicKey
The resulting type after applying the * operator.
fn mul(self, rhs: PublicKey) -> PublicKey[src]
fn mul(self, rhs: PublicKey) -> PublicKeyPerforms the * operation.
impl Combinable for PublicKey[src]
impl Combinable for PublicKey