@@ -64,8 +64,8 @@ import { bytesToHex, hexToBytes, concatBytes, utf8ToBytes } from '@noble/curves/
64
64
- [ Hedged ECDSA with noise] ( #hedged-ecdsa-with-noise )
65
65
- [ ECDH: Diffie-Hellman shared secrets] ( #ecdh-diffie-hellman-shared-secrets )
66
66
- [ secp256k1 Schnorr signatures from BIP340] ( #secp256k1-schnorr-signatures-from-bip340 )
67
- - [ ed25519, X25519, ristretto255] ( #ed25519-x25519- ristretto255 )
68
- - [ ed448, X448, decaf448] ( #ed448-x448- decaf448 )
67
+ - [ ed25519] ( #ed25519 ) / [ X25519] ( #x25519 ) / [ ristretto255] ( #ristretto255 )
68
+ - [ ed448] ( #ed448 ) / [ X448] ( #x448 ) / [ decaf448] ( #decaf448 )
69
69
- [ bls12-381] ( #bls12-381 )
70
70
- [ bn254 aka alt_bn128] ( #bn254-aka-alt_bn128 )
71
71
- [ Low-level methods] ( #low-level-methods )
@@ -136,7 +136,7 @@ const sig = schnorr.sign(msg, priv);
136
136
const isValid = schnorr .verify (sig , msg , pub );
137
137
```
138
138
139
- #### ed25519, X25519, ristretto255
139
+ #### ed25519
140
140
141
141
``` ts
142
142
import { ed25519 } from ' @noble/curves/ed25519' ;
@@ -153,14 +153,14 @@ import { ed25519ctx, ed25519ph } from '@noble/curves/ed25519';
153
153
154
154
Default ` verify ` behavior follows ZIP215 and
155
155
can be used in consensus-critical applications.
156
- It has SUF-CMA (strong unforgeability under chosen message attacks).
157
156
If you need SBS (Strongly Binding Signatures) and FIPS 186-5 compliance,
158
157
use ` zip215: false ` . Check out [ Edwards Signatures section for more info] ( #edwards-twisted-edwards-curve ) .
158
+ Both options have SUF-CMA (strong unforgeability under chosen message attacks).
159
159
160
- X25519 follows [ RFC7748 ] ( https://www.rfc-editor.org/rfc/rfc7748 ) .
160
+ #### X25519
161
161
162
162
``` ts
163
- // ECDH using curve25519 aka x25519
163
+ // ECDH using curve25519 aka x25519 from [RFC7748](https://www.rfc-editor.org/rfc/rfc7748)
164
164
import { x25519 } from ' @noble/curves/ed25519' ;
165
165
const priv = ' a546e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449ac4' ;
166
166
const pub = ' e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c' ;
@@ -174,10 +174,11 @@ edwardsToMontgomeryPub(ed25519.getPublicKey(ed25519.utils.randomPrivateKey()));
174
174
edwardsToMontgomeryPriv (ed25519 .utils .randomPrivateKey ());
175
175
```
176
176
177
- ristretto255 follows [ irtf draft ] ( https://datatracker.ietf.org/doc/html/draft-irtf-cfrg- ristretto255-decaf448 ) .
177
+ #### ristretto255
178
178
179
179
``` ts
180
- // hash-to-curve, ristretto255
180
+ // hash-to-curve, ristretto255 from
181
+ // [irtf draft](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448)
181
182
import { utf8ToBytes } from ' @noble/hashes/utils' ;
182
183
import { sha512 } from ' @noble/hashes/sha512' ;
183
184
import {
@@ -201,7 +202,7 @@ RistrettoPoint.hashToCurve(sha512(msg));
201
202
hashToRistretto255 (msg , { DST: ' ristretto255_XMD:SHA-512_R255MAP_RO_' });
202
203
```
203
204
204
- #### ed448, X448, decaf448
205
+ #### ed448
205
206
206
207
``` ts
207
208
import { ed448 } from ' @noble/curves/ed448' ;
@@ -215,9 +216,10 @@ ed448.verify(sig, msg, pub);
215
216
import { ed448ph } from ' @noble/curves/ed448' ;
216
217
```
217
218
218
- ECDH using Curve448 aka X448, follows [ RFC7748 ] ( https://www.rfc-editor.org/rfc/rfc7748 ) .
219
+ #### X448
219
220
220
221
``` ts
222
+ // ECDH using Curve448 aka X448, follows [RFC7748](https://www.rfc-editor.org/rfc/rfc7748).
221
223
import { x448 } from ' @noble/curves/ed448' ;
222
224
x448 .getSharedSecret (priv , pub ) === x448 .scalarMult (priv , pub ); // aliases
223
225
x448 .getPublicKey (priv ) === x448 .scalarMultBase (priv );
@@ -227,9 +229,11 @@ import { edwardsToMontgomeryPub } from '@noble/curves/ed448';
227
229
edwardsToMontgomeryPub (ed448 .getPublicKey (ed448 .utils .randomPrivateKey ()));
228
230
```
229
231
230
- decaf448 follows [ irtf draft ] ( https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255- decaf448) .
232
+ #### decaf448
231
233
232
234
``` ts
235
+ // decaf448 follows
236
+ // [irtf draft](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448)
233
237
import { utf8ToBytes } from ' @noble/hashes/utils' ;
234
238
import { shake256 } from ' @noble/hashes/sha3' ;
235
239
import { hashToCurve , encodeToCurve , DecafPoint , hashToDecaf448 } from ' @noble/curves/ed448' ;
0 commit comments