mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-05 20:30:57 +00:00
Add .to_bytes() to PublicKey, so that it has similar capabilities to the ed25519 PublicKey impl. Also to SharedSecret for consistency.
This commit is contained in:
parent
9567e021c5
commit
1d61e1ba46
1 changed files with 12 additions and 0 deletions
|
|
@ -36,6 +36,12 @@ impl From<[u8; 32]> for PublicKey {
|
|||
}
|
||||
|
||||
impl PublicKey {
|
||||
/// Convert this public key to a byte array.
|
||||
#[inline]
|
||||
pub fn to_bytes(&self) -> [u8; 32] {
|
||||
self.0.to_bytes()
|
||||
}
|
||||
|
||||
/// View this public key as a byte array.
|
||||
#[inline]
|
||||
pub fn as_bytes(&self) -> &[u8; 32] {
|
||||
|
|
@ -149,6 +155,12 @@ impl Drop for SharedSecret {
|
|||
}
|
||||
|
||||
impl SharedSecret {
|
||||
/// Convert this shared secret to a byte array.
|
||||
#[inline]
|
||||
pub fn to_bytes(&self) -> [u8; 32] {
|
||||
self.0.to_bytes()
|
||||
}
|
||||
|
||||
/// View this shared secret key as a byte array.
|
||||
#[inline]
|
||||
pub fn as_bytes(&self) -> &[u8; 32] {
|
||||
|
|
|
|||
Loading…
Reference in a new issue