curv
curv copied to clipboard
Implement elliptic curve trait for P-256
Basically - we need to find a good library that implement P-256 elliptic curve and implement with it the trait:
pub trait ECScalar<SK> {
fn new_random() -> Self;
fn get_element(&self) -> SK;
fn set_element(&mut self, element: SK);
fn from(n: &BigInt) -> Self;
fn to_big_int(&self) -> BigInt;
fn q(&self) -> BigInt;
fn add(&self, other: &SK) -> Self;
fn mul(&self, other: &SK) -> Self;
fn sub(&self, other: &SK) -> Self;
fn invert(&self) -> Self;
}
pub trait ECPoint<PK, SK>
where Self: Sized{
fn generator() -> Self;
fn get_element(&self) -> PK;
fn x_coor(&self) -> BigInt;
fn y_coor(&self) -> BigInt;
fn bytes_compressed_to_big_int(&self) -> BigInt;
fn from_bytes(bytes: &[u8]) -> Result<Self, ErrorKey>;
fn pk_to_key_slice(&self) -> Vec<u8>;
fn scalar_mul(self, fe: &SK) -> Self;
fn add_point(&self, other: &PK) -> Self;
fn sub_point(&self, other: &PK) -> Self;
fn from_coor(x: &BigInt, y: &BigInt) -> Self;
}
any updates?
Hi! Not really (sadly): do you want to recommend on s good library or help?
There are many c libraries but haven't found a good pure rust library for this curve.