diff --git a/rust-arkworks/Cargo.toml b/rust-arkworks/Cargo.toml index 80c96ba..a2c5293 100644 --- a/rust-arkworks/Cargo.toml +++ b/rust-arkworks/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ark-ec = "0.3.0" +ark-ec = "~0.3.0" ark-ff = "0.3.0" ark-std = "0.3.0" ark-serialize = "0.3.0" diff --git a/rust-arkworks/src/hash_to_curve.rs b/rust-arkworks/src/hash_to_curve.rs index bbe8133..c3fac28 100644 --- a/rust-arkworks/src/hash_to_curve.rs +++ b/rust-arkworks/src/hash_to_curve.rs @@ -2,7 +2,7 @@ use crate::error::CryptoError; use ark_ec::{AffineCurve, ProjectiveCurve}; use tiny_keccak::{Hasher, Shake, Xof}; use elliptic_curve::hash2curve::{ExpandMsgXmd, GroupDigest}; -use k256::{AffinePoint}; +use k256::AffinePoint; use k256::sha2::Sha256; use elliptic_curve::sec1::ToEncodedPoint; use ark_ec::short_weierstrass_jacobian::GroupAffine; @@ -31,18 +31,17 @@ pub fn hash_to_curve< let pt_affine = pt.to_affine(); - k256_affine_to_arkworks_secp256k1_affine::(pt_affine) + k256_affine_to_arkworks_secp256k1_affine::

(pt_affine) } pub fn k256_affine_to_arkworks_secp256k1_affine< - Fp: ark_ff::PrimeField, P: ark_ec::SWModelParameters >( k_pt: AffinePoint, ) -> GroupAffine

{ let encoded_pt = k_pt.to_encoded_point(false); - let num_field_bytes = 320; + let num_field_bytes = 40; // extract k_pt.x let k_pt_x_bytes = encoded_pt.x().unwrap(); diff --git a/rust-arkworks/src/tests.rs b/rust-arkworks/src/tests.rs index 759f7f6..2f0bcaa 100644 --- a/rust-arkworks/src/tests.rs +++ b/rust-arkworks/src/tests.rs @@ -40,7 +40,6 @@ pub fn test_k256_affine_to_arkworks_secp256k1_affine() { // Convert k256_pt to an arkworks point let converted_pt = k256_affine_to_arkworks_secp256k1_affine::< - secp256k1::fields::Fq, Secp256k1Parameters >(k256_pt.to_affine());