mirror of
https://github.com/arnaucube/arkeddsa.git
synced 2026-01-12 00:01:28 +01:00
wip2
This commit is contained in:
@@ -4,8 +4,9 @@ use ark_crypto_primitives::sponge::{
|
|||||||
Absorb, CryptographicSponge,
|
Absorb, CryptographicSponge,
|
||||||
};
|
};
|
||||||
use ark_ec::{
|
use ark_ec::{
|
||||||
twisted_edwards::{Affine, TECurveConfig},
|
// twisted_edwards::{Affine, TECurveConfig},
|
||||||
AffineRepr, CurveGroup,
|
AffineRepr,
|
||||||
|
CurveGroup,
|
||||||
};
|
};
|
||||||
use ark_ff::{BigInteger, PrimeField};
|
use ark_ff::{BigInteger, PrimeField};
|
||||||
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
|
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
use ark_ec::twisted_edwards::Affine;
|
use ark_ec::{AffineRepr, CurveGroup};
|
||||||
use ark_ec::twisted_edwards::TECurveConfig;
|
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
|
||||||
use ark_ec::CurveGroup;
|
|
||||||
use ark_serialize::CanonicalDeserialize;
|
|
||||||
use ark_serialize::CanonicalSerialize;
|
|
||||||
|
|
||||||
/// `SignatureComponents` contains the realized parts of a signature
|
/// `SignatureComponents` contains the realized parts of a signature
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, CanonicalSerialize, CanonicalDeserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, CanonicalSerialize, CanonicalDeserialize)]
|
||||||
@@ -12,7 +9,6 @@ pub struct Signature<C: CurveGroup + Clone> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<C: CurveGroup + Clone> Signature<C> {
|
impl<C: CurveGroup + Clone> Signature<C> {
|
||||||
/*
|
|
||||||
/// Serializes the signature components to bytes as uncompressed.
|
/// Serializes the signature components to bytes as uncompressed.
|
||||||
/// Expect output size to be `size_of(C::BaseField) * 2 + size_of(C::ScalarField)`
|
/// Expect output size to be `size_of(C::BaseField) * 2 + size_of(C::ScalarField)`
|
||||||
pub fn to_bytes(&self) -> Vec<u8> {
|
pub fn to_bytes(&self) -> Vec<u8> {
|
||||||
@@ -25,8 +21,8 @@ impl<C: CurveGroup + Clone> Signature<C> {
|
|||||||
/// Checked deserialization of the signature components from bytes.
|
/// Checked deserialization of the signature components from bytes.
|
||||||
/// Expects input size to be `size_of(C::BaseField) * 2 + size_of(C::ScalarField)`
|
/// Expects input size to be `size_of(C::BaseField) * 2 + size_of(C::ScalarField)`
|
||||||
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Box<dyn ark_std::error::Error>> {
|
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Box<dyn ark_std::error::Error>> {
|
||||||
let point_size = C::Affine::Config::serialized_size(ark_serialize::Compress::No);
|
let point_size = C::Affine::generator().serialized_size(ark_serialize::Compress::No);
|
||||||
(bytes.len() == 32 + C::Affine::Config::serialized_size(ark_serialize::Compress::No))
|
(bytes.len() == 32 + point_size)
|
||||||
.then_some(true)
|
.then_some(true)
|
||||||
.ok_or(ark_serialize::SerializationError::InvalidData)?;
|
.ok_or(ark_serialize::SerializationError::InvalidData)?;
|
||||||
|
|
||||||
@@ -37,7 +33,6 @@ impl<C: CurveGroup + Clone> Signature<C> {
|
|||||||
let s = C::ScalarField::deserialize_uncompressed(&bytes[off1..off2])?;
|
let s = C::ScalarField::deserialize_uncompressed(&bytes[off1..off2])?;
|
||||||
Ok(Signature { r, s })
|
Ok(Signature { r, s })
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
pub fn new(r: C::Affine, s: C::ScalarField) -> Self {
|
pub fn new(r: C::Affine, s: C::ScalarField) -> Self {
|
||||||
Self { r, s }
|
Self { r, s }
|
||||||
|
|||||||
Reference in New Issue
Block a user