Skip to content

Commit ad2887c

Browse files
committed
readme
1 parent 5c991ea commit ad2887c

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

README.md

+15-11
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ import { bytesToHex, hexToBytes, concatBytes, utf8ToBytes } from '@noble/curves/
6464
- [Hedged ECDSA with noise](#hedged-ecdsa-with-noise)
6565
- [ECDH: Diffie-Hellman shared secrets](#ecdh-diffie-hellman-shared-secrets)
6666
- [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)
6969
- [bls12-381](#bls12-381)
7070
- [bn254 aka alt_bn128](#bn254-aka-alt_bn128)
7171
- [Low-level methods](#low-level-methods)
@@ -136,7 +136,7 @@ const sig = schnorr.sign(msg, priv);
136136
const isValid = schnorr.verify(sig, msg, pub);
137137
```
138138

139-
#### ed25519, X25519, ristretto255
139+
#### ed25519
140140

141141
```ts
142142
import { ed25519 } from '@noble/curves/ed25519';
@@ -153,14 +153,14 @@ import { ed25519ctx, ed25519ph } from '@noble/curves/ed25519';
153153

154154
Default `verify` behavior follows ZIP215 and
155155
can be used in consensus-critical applications.
156-
It has SUF-CMA (strong unforgeability under chosen message attacks).
157156
If you need SBS (Strongly Binding Signatures) and FIPS 186-5 compliance,
158157
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).
159159

160-
X25519 follows [RFC7748](https://www.rfc-editor.org/rfc/rfc7748).
160+
#### X25519
161161

162162
```ts
163-
// ECDH using curve25519 aka x25519
163+
// ECDH using curve25519 aka x25519 from [RFC7748](https://www.rfc-editor.org/rfc/rfc7748)
164164
import { x25519 } from '@noble/curves/ed25519';
165165
const priv = 'a546e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449ac4';
166166
const pub = 'e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c';
@@ -174,10 +174,11 @@ edwardsToMontgomeryPub(ed25519.getPublicKey(ed25519.utils.randomPrivateKey()));
174174
edwardsToMontgomeryPriv(ed25519.utils.randomPrivateKey());
175175
```
176176

177-
ristretto255 follows [irtf draft](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448).
177+
#### ristretto255
178178

179179
```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)
181182
import { utf8ToBytes } from '@noble/hashes/utils';
182183
import { sha512 } from '@noble/hashes/sha512';
183184
import {
@@ -201,7 +202,7 @@ RistrettoPoint.hashToCurve(sha512(msg));
201202
hashToRistretto255(msg, { DST: 'ristretto255_XMD:SHA-512_R255MAP_RO_' });
202203
```
203204

204-
#### ed448, X448, decaf448
205+
#### ed448
205206

206207
```ts
207208
import { ed448 } from '@noble/curves/ed448';
@@ -215,9 +216,10 @@ ed448.verify(sig, msg, pub);
215216
import { ed448ph } from '@noble/curves/ed448';
216217
```
217218

218-
ECDH using Curve448 aka X448, follows [RFC7748](https://www.rfc-editor.org/rfc/rfc7748).
219+
#### X448
219220

220221
```ts
222+
// ECDH using Curve448 aka X448, follows [RFC7748](https://www.rfc-editor.org/rfc/rfc7748).
221223
import { x448 } from '@noble/curves/ed448';
222224
x448.getSharedSecret(priv, pub) === x448.scalarMult(priv, pub); // aliases
223225
x448.getPublicKey(priv) === x448.scalarMultBase(priv);
@@ -227,9 +229,11 @@ import { edwardsToMontgomeryPub } from '@noble/curves/ed448';
227229
edwardsToMontgomeryPub(ed448.getPublicKey(ed448.utils.randomPrivateKey()));
228230
```
229231

230-
decaf448 follows [irtf draft](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448).
232+
#### decaf448
231233

232234
```ts
235+
// decaf448 follows
236+
// [irtf draft](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448)
233237
import { utf8ToBytes } from '@noble/hashes/utils';
234238
import { shake256 } from '@noble/hashes/sha3';
235239
import { hashToCurve, encodeToCurve, DecafPoint, hashToDecaf448 } from '@noble/curves/ed448';

0 commit comments

Comments
 (0)