#[cfg(feature = "std")]
use std::vec::Vec;
#[cfg(all(not(feature = "std"), feature = "alloc"))]
extern crate alloc;
#[cfg(all(not(feature = "std"), feature = "alloc"))]
use alloc::vec::Vec;
#[cfg(any(feature = "std", feature = "alloc"))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Point {
pub x: Vec<u8>,
pub y: Vec<u8>,
pub z: Option<Vec<u8>>, }
#[cfg(any(feature = "std", feature = "alloc"))]
impl Point {
pub fn new_affine(x: Vec<u8>, y: Vec<u8>) -> Self {
Self { x, y, z: None }
}
pub fn new_projective(x: Vec<u8>, y: Vec<u8>, z: Vec<u8>) -> Self {
Self { x, y, z: Some(z) }
}
pub fn is_infinity(&self) -> bool {
match &self.z {
Some(z) => z.iter().all(|&b| b == 0),
None => self.x.is_empty() && self.y.is_empty(),
}
}
}
#[cfg(any(feature = "std", feature = "alloc"))]
#[derive(Clone, Debug)]
pub struct CurveParams {
pub a: Vec<u8>,
pub b: Vec<u8>,
pub p: Vec<u8>,
pub order: Vec<u8>,
pub cofactor: Vec<u8>,
pub generator: Point,
}