mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
Merge branch 'develop' into serde-compressed
This commit is contained in:
commit
e6c9243e46
2 changed files with 28 additions and 0 deletions
|
|
@ -311,6 +311,21 @@ impl Default for CompressedEdwardsY {
|
|||
}
|
||||
}
|
||||
|
||||
impl CompressedEdwardsY {
|
||||
/// Construct a `CompressedEdwardsY` from a slice of bytes.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// If the input `bytes` slice does not have a length of 32.
|
||||
pub fn from_slice(bytes: &[u8]) -> CompressedEdwardsY {
|
||||
let mut tmp = [0u8; 32];
|
||||
|
||||
tmp.copy_from_slice(bytes);
|
||||
|
||||
CompressedEdwardsY(tmp)
|
||||
}
|
||||
}
|
||||
|
||||
impl Identity for EdwardsPoint {
|
||||
fn identity() -> EdwardsPoint {
|
||||
EdwardsPoint{ X: FieldElement::zero(),
|
||||
|
|
|
|||
|
|
@ -213,6 +213,19 @@ impl CompressedRistretto {
|
|||
&self.0
|
||||
}
|
||||
|
||||
/// Construct a `CompressedRistretto` from a slice of bytes.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// If the input `bytes` slice does not have a length of 32.
|
||||
pub fn from_slice(bytes: &[u8]) -> CompressedRistretto {
|
||||
let mut tmp = [0u8; 32];
|
||||
|
||||
tmp.copy_from_slice(bytes);
|
||||
|
||||
CompressedRistretto(tmp)
|
||||
}
|
||||
|
||||
/// Attempt to decompress to an `RistrettoPoint`.
|
||||
///
|
||||
/// # Return
|
||||
|
|
|
|||
Loading…
Reference in a new issue