mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-03 19:53:40 +00:00
Remove CurveAffine::{read, write}
This removes the last dependency on `std::io`.
This commit is contained in:
parent
f874d29238
commit
69cf8f5f77
2 changed files with 2 additions and 16 deletions
|
|
@ -22,6 +22,8 @@ and this project adheres to Rust's notion of
|
|||
- `FieldExt::{from_bytes, read, to_bytes, write}`
|
||||
(use `ff::PrimeField::{from_repr, to_repr}` instead).
|
||||
- `FieldExt::rand` (use `ff::Field::random` instead).
|
||||
- `CurveAffine::{read, write}`
|
||||
(use `group::GroupEncoding::{from_bytes, to_bytes}` instead).
|
||||
|
||||
## [0.2.1] - 2021-09-17
|
||||
### Changed
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ use super::{FieldExt, Group};
|
|||
#[cfg(feature = "std")]
|
||||
use std::{
|
||||
boxed::Box,
|
||||
io::{self, Read, Write},
|
||||
ops::{Add, Mul, Sub},
|
||||
};
|
||||
|
||||
|
|
@ -123,21 +122,6 @@ pub trait CurveAffine:
|
|||
/// always be true unless an "unchecked" API was used.
|
||||
fn is_on_curve(&self) -> Choice;
|
||||
|
||||
/// Reads a compressed element from the buffer and attempts to parse it
|
||||
/// using `from_bytes`.
|
||||
fn read<R: Read>(reader: &mut R) -> io::Result<Self> {
|
||||
let mut compressed = Self::Repr::default();
|
||||
reader.read_exact(compressed.as_mut())?;
|
||||
Option::from(Self::from_bytes(&compressed))
|
||||
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, "invalid point encoding in proof"))
|
||||
}
|
||||
|
||||
/// Writes an element in compressed form to the buffer.
|
||||
fn write<W: Write>(&self, writer: &mut W) -> io::Result<()> {
|
||||
let compressed = self.to_bytes();
|
||||
writer.write_all(compressed.as_ref())
|
||||
}
|
||||
|
||||
/// Returns the curve constant $a$.
|
||||
fn a() -> Self::Base;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue