mirror of
https://github.com/saymrwulf/risc0-curve25519-dalek-source.git
synced 2026-09-04 20:03:40 +00:00
Merge pull request #43 from peat/master
Add .to_bytes() to PublicKey, SharedSecret
This commit is contained in:
commit
5d245dcefa
1 changed files with 12 additions and 0 deletions
|
|
@ -41,6 +41,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] {
|
||||
|
|
@ -143,6 +149,12 @@ impl<'a> From<&'a StaticSecret> for PublicKey {
|
|||
pub struct SharedSecret(pub(crate) MontgomeryPoint);
|
||||
|
||||
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