Depend on ProjectivePoint: ToEncodedPoint (#95)

This commit is contained in:
daxpedda
2023-01-31 14:19:33 -08:00
committed by GitHub
parent 74eaebe446
commit 0409db6f40
+2 -3
View File
@@ -23,7 +23,7 @@ use crate::{Error, InternalError, Result};
impl<C> Group for C impl<C> Group for C
where where
C: GroupDigest, C: GroupDigest,
ProjectivePoint<Self>: CofactorGroup, ProjectivePoint<Self>: CofactorGroup + ToEncodedPoint<Self>,
FieldSize<Self>: ModulusSize, FieldSize<Self>: ModulusSize,
AffinePoint<Self>: FromEncodedPoint<Self> + ToEncodedPoint<Self>, AffinePoint<Self>: FromEncodedPoint<Self> + ToEncodedPoint<Self>,
Scalar<Self>: FromOkm, Scalar<Self>: FromOkm,
@@ -65,8 +65,7 @@ where
} }
fn serialize_elem(elem: Self::Elem) -> GenericArray<u8, Self::ElemLen> { fn serialize_elem(elem: Self::Elem) -> GenericArray<u8, Self::ElemLen> {
let affine: AffinePoint<Self> = elem.into(); let bytes = elem.to_encoded_point(true);
let bytes = affine.to_encoded_point(true);
let bytes = bytes.as_bytes(); let bytes = bytes.as_bytes();
let mut result = GenericArray::default(); let mut result = GenericArray::default();
result[..bytes.len()].copy_from_slice(bytes); result[..bytes.len()].copy_from_slice(bytes);