Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
refactor: move ecdsa/eddsa to sub-directory
Browse files Browse the repository at this point in the history
  • Loading branch information
shuklaayush committed Jul 11, 2023
1 parent 28d6314 commit 4c36182
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/examples.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mod ecdsa_secp256k1;
mod ed25519;
12 changes: 6 additions & 6 deletions src/secp256k1.nr → src/examples/ecdsa_secp256k1.nr
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,6 @@ fn test_secp256k1_mul5() {

#[test]
fn test_secp256k1_verification_preshashed() {
let msghash = Fq::from_bytes([
0xe2, 0xc1, 0xc8, 0x3a, 0x63, 0xb4, 0x06, 0x68,
0xda, 0xc2, 0xd9, 0x35, 0xd0, 0x49, 0x69, 0x47,
0x35, 0x88, 0x35, 0x8d, 0x7e, 0xcd, 0x21, 0x1f,
0x12, 0xd2, 0x5c, 0x3a, 0x12, 0xf4, 0x73, 0x3a,
]);
let pubkey = Point::from_affine(
Fp::from_bytes([
0xc7, 0x47, 0xe2, 0x47, 0x2a, 0x8e, 0xa6, 0x52,
Expand All @@ -265,6 +259,12 @@ fn test_secp256k1_verification_preshashed() {
0x80, 0xf4, 0x61, 0x1d, 0x93, 0xcc, 0x70, 0x87,
0xb7, 0x71, 0x4e, 0x34, 0x94, 0x98, 0x11, 0x28,
]);
let msghash = Fq::from_bytes([
0xe2, 0xc1, 0xc8, 0x3a, 0x63, 0xb4, 0x06, 0x68,
0xda, 0xc2, 0xd9, 0x35, 0xd0, 0x49, 0x69, 0x47,
0x35, 0x88, 0x35, 0x8d, 0x7e, 0xcd, 0x21, 0x1f,
0x12, 0xd2, 0x5c, 0x3a, 0x12, 0xf4, 0x73, 0x3a,
]);

assert(verify_signature(pubkey, r, s, msghash));
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use dep::std::println;

use crate::secp256k1::fp::PrimeField as Fp;
use crate::secp256k1::fq::PrimeField as Fq;
use crate::examples::ecdsa_secp256k1::fp::PrimeField as Fp;
use crate::examples::ecdsa_secp256k1::fq::PrimeField as Fq;

// Point in three-dimensional Jacobian coordinates
struct Point {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/ed25519/tecurve.nr → src/examples/ed25519/tecurve.nr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use dep::std::println;

use crate::ed25519::fp::PrimeField as Fp;
use crate::ed25519::fq::PrimeField as Fq;
use crate::examples::ed25519::fp::PrimeField as Fp;
use crate::examples::ed25519::fq::PrimeField as Fq;

// Point in extended twisted Edwards coordinates
struct Point {
Expand Down
3 changes: 1 addition & 2 deletions src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use dep::std::println;

mod utils;
mod prime_field;
mod ed25519;
mod secp256k1;
mod examples;

// BUG: Noir doesn't automatically add `comptime` to all globals, hence strongly typed
// Number of bits per limb.
Expand Down

0 comments on commit 4c36182

Please sign in to comment.