1
1
use criterion:: { BatchSize , Criterion , criterion_group, criterion_main} ;
2
2
use ed448_goldilocks:: {
3
- CompressedDecaf , CompressedEdwardsY , Decaf448 , DecafPoint , DecafScalar , EdwardsPoint ,
4
- EdwardsScalar , MontgomeryPoint ,
3
+ Decaf448 , DecafPoint , DecafScalar , EdwardsPoint , EdwardsScalar , MontgomeryPoint ,
5
4
} ;
6
5
use elliptic_curve:: group:: GroupEncoding ;
7
6
use elliptic_curve:: { Field , Group } ;
@@ -36,18 +35,6 @@ pub fn ed448(c: &mut Criterion) {
36
35
)
37
36
} ) ;
38
37
39
- group. bench_function ( "hash_to_curve" , |b| {
40
- b. iter_batched (
41
- || {
42
- let mut msg = [ 0 ; 64 ] ;
43
- OsRng . try_fill_bytes ( & mut msg) . unwrap ( ) ;
44
- msg
45
- } ,
46
- |msg| EdwardsPoint :: hash_with_defaults ( & msg) ,
47
- BatchSize :: SmallInput ,
48
- )
49
- } ) ;
50
-
51
38
group. bench_function ( "encode_to_curve" , |b| {
52
39
b. iter_batched (
53
40
|| {
@@ -60,22 +47,6 @@ pub fn ed448(c: &mut Criterion) {
60
47
)
61
48
} ) ;
62
49
63
- group. bench_function ( "compress" , |b| {
64
- b. iter_batched (
65
- || EdwardsPoint :: try_from_rng ( & mut OsRng ) . unwrap ( ) ,
66
- |point| point. to_bytes ( ) . 0 ,
67
- BatchSize :: SmallInput ,
68
- )
69
- } ) ;
70
-
71
- group. bench_function ( "decompress" , |b| {
72
- b. iter_batched (
73
- || EdwardsPoint :: try_from_rng ( & mut OsRng ) . unwrap ( ) . to_bytes ( ) . 0 ,
74
- |bytes| CompressedEdwardsY ( bytes) . decompress ( ) . unwrap ( ) ,
75
- BatchSize :: SmallInput ,
76
- )
77
- } ) ;
78
-
79
50
group. finish ( ) ;
80
51
}
81
52
@@ -106,23 +77,6 @@ pub fn decaf448(c: &mut Criterion) {
106
77
)
107
78
} ) ;
108
79
109
- group. bench_function ( "hash_to_curve" , |b| {
110
- b. iter_batched (
111
- || {
112
- let mut msg = [ 0 ; 64 ] ;
113
- OsRng . try_fill_bytes ( & mut msg) . unwrap ( ) ;
114
- msg
115
- } ,
116
- |msg| {
117
- Decaf448 :: hash_from_bytes :: < ExpandMsgXof < Shake256 > > (
118
- & [ & msg] ,
119
- & [ b"decaf448_XOF:SHAKE256_D448MAP_RO_" ] ,
120
- )
121
- } ,
122
- BatchSize :: SmallInput ,
123
- )
124
- } ) ;
125
-
126
80
group. bench_function ( "encode_to_curve" , |b| {
127
81
b. iter_batched (
128
82
|| {
@@ -140,27 +94,27 @@ pub fn decaf448(c: &mut Criterion) {
140
94
)
141
95
} ) ;
142
96
143
- group. bench_function ( "compress " , |b| {
97
+ group. bench_function ( "encode " , |b| {
144
98
b. iter_batched (
145
99
|| DecafPoint :: try_from_rng ( & mut OsRng ) . unwrap ( ) ,
146
- |point| point. compress ( ) . 0 ,
100
+ |point| point. to_bytes ( ) ,
147
101
BatchSize :: SmallInput ,
148
102
)
149
103
} ) ;
150
104
151
- group. bench_function ( "decompress " , |b| {
105
+ group. bench_function ( "decode " , |b| {
152
106
b. iter_batched (
153
- || DecafPoint :: try_from_rng ( & mut OsRng ) . unwrap ( ) . compress ( ) . 0 ,
154
- |bytes| CompressedDecaf ( bytes) . decompress ( ) . unwrap ( ) ,
107
+ || DecafPoint :: try_from_rng ( & mut OsRng ) . unwrap ( ) . to_bytes ( ) ,
108
+ |bytes| DecafPoint :: from_bytes ( & bytes) . unwrap ( ) ,
155
109
BatchSize :: SmallInput ,
156
110
)
157
111
} ) ;
158
112
159
113
group. finish ( ) ;
160
114
}
161
115
162
- pub fn curve448 ( c : & mut Criterion ) {
163
- let mut group = c. benchmark_group ( "Curve448 " ) ;
116
+ pub fn x448 ( c : & mut Criterion ) {
117
+ let mut group = c. benchmark_group ( "X448 " ) ;
164
118
165
119
group. bench_function ( "scalar multiplication" , |b| {
166
120
b. iter_batched (
@@ -178,5 +132,5 @@ pub fn curve448(c: &mut Criterion) {
178
132
group. finish ( ) ;
179
133
}
180
134
181
- criterion_group ! ( benches, ed448, decaf448, curve448 ) ;
135
+ criterion_group ! ( benches, ed448, decaf448, x448 ) ;
182
136
criterion_main ! ( benches) ;
0 commit comments