Skip to content

Commit 533f01a

Browse files
authored
k256/p256: factor out affine and projective submodules (#157)
Refactors the `arithmetic` module, extracting `affine` and `projective` modules which now contain `AffinePoint` and `ProjectivePoint` respectively.
1 parent 848e392 commit 533f01a

File tree

11 files changed

+1532
-1497
lines changed

11 files changed

+1532
-1497
lines changed

k256/bench/bench.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,29 @@ use core::convert::TryInto;
22
use criterion::measurement::Measurement;
33
use criterion::{criterion_group, criterion_main, BenchmarkGroup, Criterion};
44

5-
use k256::{FieldElement, ProjectivePoint, Scalar};
5+
use k256::{elliptic_curve::FromBytes, FieldElement, ProjectivePoint, Scalar};
66

77
fn test_scalar_x() -> Scalar {
8-
Scalar::from_bytes(&[
9-
0xbb, 0x48, 0x8a, 0xef, 0x41, 0x6a, 0x41, 0xd7, 0x68, 0x0d, 0x1c, 0xf0, 0x1d, 0x70, 0xf5,
10-
0x9b, 0x60, 0xd7, 0xf5, 0xf7, 0x7e, 0x30, 0xe7, 0x8b, 0x8b, 0xf9, 0xd2, 0xd8, 0x82, 0xf1,
11-
0x56, 0xa6,
12-
])
8+
Scalar::from_bytes(
9+
&[
10+
0xbb, 0x48, 0x8a, 0xef, 0x41, 0x6a, 0x41, 0xd7, 0x68, 0x0d, 0x1c, 0xf0, 0x1d, 0x70,
11+
0xf5, 0x9b, 0x60, 0xd7, 0xf5, 0xf7, 0x7e, 0x30, 0xe7, 0x8b, 0x8b, 0xf9, 0xd2, 0xd8,
12+
0x82, 0xf1, 0x56, 0xa6,
13+
]
14+
.into(),
15+
)
1316
.unwrap()
1417
}
1518

1619
fn test_scalar_y() -> Scalar {
17-
Scalar::from_bytes(&[
18-
0x67, 0xe2, 0xf6, 0x80, 0x71, 0xed, 0x82, 0x81, 0xe8, 0xae, 0xd6, 0xbc, 0xf1, 0xc5, 0x20,
19-
0x7c, 0x5e, 0x63, 0x37, 0x22, 0xd9, 0x20, 0xaf, 0xd6, 0xae, 0x22, 0xd0, 0x6e, 0xeb, 0x80,
20-
0x35, 0xe3,
21-
])
20+
Scalar::from_bytes(
21+
&[
22+
0x67, 0xe2, 0xf6, 0x80, 0x71, 0xed, 0x82, 0x81, 0xe8, 0xae, 0xd6, 0xbc, 0xf1, 0xc5,
23+
0x20, 0x7c, 0x5e, 0x63, 0x37, 0x22, 0xd9, 0x20, 0xaf, 0xd6, 0xae, 0x22, 0xd0, 0x6e,
24+
0xeb, 0x80, 0x35, 0xe3,
25+
]
26+
.into(),
27+
)
2228
.unwrap()
2329
}
2430

0 commit comments

Comments
 (0)