Skip to content

Commit

Permalink
Solve #18
Browse files Browse the repository at this point in the history
Also bump `ark-ec` minor version and fix some linting
  • Loading branch information
skaunov committed Sep 25, 2023
1 parent f787cb3 commit fce6b81
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion rust-arkworks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 3 additions & 4 deletions rust-arkworks/src/hash_to_curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -31,18 +31,17 @@ pub fn hash_to_curve<

let pt_affine = pt.to_affine();

k256_affine_to_arkworks_secp256k1_affine::<Fp, P>(pt_affine)
k256_affine_to_arkworks_secp256k1_affine::<P>(pt_affine)
}

pub fn k256_affine_to_arkworks_secp256k1_affine<
Fp: ark_ff::PrimeField,
P: ark_ec::SWModelParameters
>(
k_pt: AffinePoint,
) -> GroupAffine<P> {
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();
Expand Down
1 change: 0 additions & 1 deletion rust-arkworks/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit fce6b81

Please sign in to comment.