mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
Merge pull request #29 from dalek-cryptography/as_bytes_for_ephemeral_public
Add EphemeralPublic::as_bytes
This commit is contained in:
commit
759d35b8c4
1 changed files with 8 additions and 2 deletions
|
|
@ -31,7 +31,14 @@ impl From<[u8; 32]> for EphemeralPublic {
|
||||||
fn from(bytes: [u8; 32]) -> EphemeralPublic {
|
fn from(bytes: [u8; 32]) -> EphemeralPublic {
|
||||||
EphemeralPublic(MontgomeryPoint(bytes))
|
EphemeralPublic(MontgomeryPoint(bytes))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl EphemeralPublic {
|
||||||
|
/// View this ephemeral public key as a byte array.
|
||||||
|
#[inline]
|
||||||
|
pub fn as_bytes(&self) -> &[u8; 32] {
|
||||||
|
self.0.as_bytes()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A DH ephemeral secret key.
|
/// A DH ephemeral secret key.
|
||||||
|
|
@ -85,11 +92,10 @@ impl Drop for SharedSecret {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SharedSecret {
|
impl SharedSecret {
|
||||||
|
|
||||||
/// View this shared secret key as a byte array.
|
/// View this shared secret key as a byte array.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn as_bytes(&self) -> &[u8; 32] {
|
pub fn as_bytes(&self) -> &[u8; 32] {
|
||||||
&self.0.as_bytes()
|
self.0.as_bytes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue