@noble/curves 0.9.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +197 -99
- package/abstract/bls.d.ts +43 -31
- package/abstract/bls.d.ts.map +1 -1
- package/abstract/bls.js +37 -28
- package/abstract/bls.js.map +1 -1
- package/abstract/edwards.d.ts +6 -2
- package/abstract/edwards.d.ts.map +1 -1
- package/abstract/edwards.js +37 -26
- package/abstract/edwards.js.map +1 -1
- package/abstract/hash-to-curve.d.ts +1 -1
- package/abstract/hash-to-curve.d.ts.map +1 -1
- package/abstract/hash-to-curve.js +3 -2
- package/abstract/hash-to-curve.js.map +1 -1
- package/abstract/modular.js +1 -1
- package/abstract/modular.js.map +1 -1
- package/abstract/utils.d.ts.map +1 -1
- package/abstract/utils.js +2 -2
- package/abstract/utils.js.map +1 -1
- package/abstract/weierstrass.d.ts +23 -0
- package/abstract/weierstrass.d.ts.map +1 -1
- package/abstract/weierstrass.js +44 -31
- package/abstract/weierstrass.js.map +1 -1
- package/bls12-381.d.ts.map +1 -1
- package/bls12-381.js +161 -162
- package/bls12-381.js.map +1 -1
- package/{bn.d.ts → bn254.d.ts} +1 -1
- package/bn254.d.ts.map +1 -0
- package/{bn.js → bn254.js} +1 -1
- package/bn254.js.map +1 -0
- package/ed25519.d.ts +9 -0
- package/ed25519.d.ts.map +1 -1
- package/ed25519.js +23 -9
- package/ed25519.js.map +1 -1
- package/ed448.d.ts +9 -0
- package/ed448.d.ts.map +1 -1
- package/ed448.js +19 -18
- package/ed448.js.map +1 -1
- package/esm/abstract/bls.js +37 -28
- package/esm/abstract/bls.js.map +1 -1
- package/esm/abstract/edwards.js +37 -26
- package/esm/abstract/edwards.js.map +1 -1
- package/esm/abstract/hash-to-curve.js +3 -2
- package/esm/abstract/hash-to-curve.js.map +1 -1
- package/esm/abstract/modular.js +1 -1
- package/esm/abstract/modular.js.map +1 -1
- package/esm/abstract/utils.js +2 -2
- package/esm/abstract/utils.js.map +1 -1
- package/esm/abstract/weierstrass.js +36 -23
- package/esm/abstract/weierstrass.js.map +1 -1
- package/esm/bls12-381.js +162 -163
- package/esm/bls12-381.js.map +1 -1
- package/esm/{bn.js → bn254.js} +1 -1
- package/esm/bn254.js.map +1 -0
- package/esm/ed25519.js +21 -8
- package/esm/ed25519.js.map +1 -1
- package/esm/ed448.js +17 -17
- package/esm/ed448.js.map +1 -1
- package/esm/p256.js +5 -6
- package/esm/p256.js.map +1 -1
- package/esm/p384.js +10 -12
- package/esm/p384.js.map +1 -1
- package/esm/p521.js +22 -18
- package/esm/p521.js.map +1 -1
- package/esm/secp256k1.js +1 -1
- package/esm/secp256k1.js.map +1 -1
- package/p256.d.ts +1 -1
- package/p256.d.ts.map +1 -1
- package/p256.js +6 -7
- package/p256.js.map +1 -1
- package/p384.d.ts +1 -1
- package/p384.d.ts.map +1 -1
- package/p384.js +11 -13
- package/p384.js.map +1 -1
- package/p521.d.ts +1 -1
- package/p521.d.ts.map +1 -1
- package/p521.js +23 -19
- package/p521.js.map +1 -1
- package/package.json +5 -8
- package/secp256k1.js +1 -1
- package/secp256k1.js.map +1 -1
- package/src/abstract/bls.ts +83 -61
- package/src/abstract/edwards.ts +49 -24
- package/src/abstract/hash-to-curve.ts +4 -3
- package/src/abstract/modular.ts +1 -1
- package/src/abstract/utils.ts +2 -2
- package/src/abstract/weierstrass.ts +36 -23
- package/src/bls12-381.ts +252 -171
- package/src/ed25519.ts +23 -9
- package/src/ed448.ts +18 -17
- package/src/p256.ts +15 -19
- package/src/p384.ts +17 -21
- package/src/p521.ts +34 -22
- package/src/secp256k1.ts +1 -1
- package/bn.d.ts.map +0 -1
- package/bn.js.map +0 -1
- package/esm/bn.js.map +0 -1
- /package/src/{bn.ts → bn254.ts} +0 -0
package/README.md
CHANGED
|
@@ -2,21 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Audited & minimal JS implementation of elliptic curve cryptography.
|
|
4
4
|
|
|
5
|
-
- Short Weierstrass, Edwards, Montgomery curves
|
|
6
|
-
- ECDSA, EdDSA, Schnorr, BLS signature schemes, ECDH key agreement
|
|
7
5
|
- 🔒 [**Audited**](#security) by an independent security firm
|
|
8
|
-
- #️⃣ [hash to curve](#abstracthash-to-curve-hashing-strings-to-curve-points)
|
|
9
|
-
for encoding or hashing an arbitrary string to an elliptic curve point
|
|
10
|
-
- 🧜♂️ [Poseidon](https://www.poseidon-hash.info) ZK-friendly hash
|
|
11
|
-
- 🏎 [Ultra-fast](#speed), hand-optimized for caveats of JS engines
|
|
12
|
-
- 🔍 Unique tests ensure correctness with Wycheproof vectors and
|
|
13
|
-
[cryptofuzz](https://github.com/guidovranken/cryptofuzz) differential fuzzing
|
|
14
6
|
- 🔻 Tree-shaking-friendly: use only what's necessary, other code won't be included
|
|
7
|
+
- 🏎 Ultra-fast, hand-optimized for caveats of JS engines
|
|
8
|
+
- 🔍 Unique tests ensure correctness: property-based, cross-library and Wycheproof vectors, fuzzing
|
|
9
|
+
- ➰ Short Weierstrass, Edwards, Montgomery curves
|
|
10
|
+
- ✍️ ECDSA, EdDSA, Schnorr, BLS signature schemes, ECDH key agreement
|
|
11
|
+
- #️⃣ Hash-to-curve
|
|
12
|
+
for encoding or hashing an arbitrary string to an elliptic curve point
|
|
13
|
+
- 🧜♂️ Poseidon ZK-friendly hash
|
|
15
14
|
|
|
16
15
|
Check out [Upgrading](#upgrading) if you've previously used single-feature noble
|
|
17
|
-
packages
|
|
18
|
-
[ed25519](https://github.com/paulmillr/noble-ed25519)).
|
|
19
|
-
See [Resources](#resources) for articles and real-world software that uses curves.
|
|
16
|
+
packages. See [Resources](#resources) for articles and real-world software that uses curves.
|
|
20
17
|
|
|
21
18
|
### This library belongs to _noble_ crypto
|
|
22
19
|
|
|
@@ -43,22 +40,25 @@ For [Deno](https://deno.land), use it with
|
|
|
43
40
|
In browser, you could also include the single file from
|
|
44
41
|
[GitHub's releases page](https://github.com/paulmillr/noble-curves/releases).
|
|
45
42
|
|
|
46
|
-
The library is tree-shaking-friendly and does
|
|
47
|
-
`import
|
|
43
|
+
The library is tree-shaking-friendly and does NOT expose root entry point as
|
|
44
|
+
`import c from '@noble/curves'`. Instead, you need to import specific primitives.
|
|
48
45
|
This is done to ensure small size of your apps.
|
|
49
46
|
|
|
50
47
|
Package consists of two parts:
|
|
51
48
|
|
|
52
|
-
1. [Implementations](#implementations), utilizing one dependency
|
|
49
|
+
1. [Implementations](#implementations), utilizing one dependency [noble-hashes](https://github.com/paulmillr/noble-hashes),
|
|
53
50
|
providing ready-to-use:
|
|
54
|
-
- NIST curves secp256r1/
|
|
51
|
+
- NIST curves secp256r1 / p256, secp384r1 / p384, secp521r1 / p521
|
|
55
52
|
- SECG curve secp256k1
|
|
56
|
-
- ed25519/curve25519/x25519/ristretto255,
|
|
53
|
+
- ed25519 / curve25519 / x25519 / ristretto255,
|
|
54
|
+
edwards448 / curve448 / x448
|
|
57
55
|
implementing
|
|
58
56
|
[RFC7748](https://www.rfc-editor.org/rfc/rfc7748) /
|
|
59
57
|
[RFC8032](https://www.rfc-editor.org/rfc/rfc8032) /
|
|
58
|
+
[FIPS 186-5](https://csrc.nist.gov/publications/detail/fips/186/5/final) /
|
|
60
59
|
[ZIP215](https://zips.z.cash/zip-0215) standards
|
|
61
60
|
- pairing-friendly curves bls12-381, bn254
|
|
61
|
+
- [pasta](https://electriccoin.co/blog/the-pasta-curves-for-halo-2-and-beyond/) curves
|
|
62
62
|
2. [Abstract](#abstract-api), zero-dependency EC algorithms
|
|
63
63
|
|
|
64
64
|
### Implementations
|
|
@@ -72,7 +72,7 @@ const priv = secp256k1.utils.randomPrivateKey();
|
|
|
72
72
|
const pub = secp256k1.getPublicKey(priv);
|
|
73
73
|
const msg = new Uint8Array(32).fill(1);
|
|
74
74
|
const sig = secp256k1.sign(msg, priv);
|
|
75
|
-
secp256k1.verify(sig, msg, pub) === true;
|
|
75
|
+
const isValid = secp256k1.verify(sig, msg, pub) === true;
|
|
76
76
|
|
|
77
77
|
// hex strings are also supported besides Uint8Arrays:
|
|
78
78
|
const privHex = '46c930bc7bb4db7f55da20798697421b98c4175a52c630294d75a84b9c126236';
|
|
@@ -90,11 +90,11 @@ import { p384 } from '@noble/curves/p384';
|
|
|
90
90
|
import { p521 } from '@noble/curves/p521';
|
|
91
91
|
import { pallas, vesta } from '@noble/curves/pasta';
|
|
92
92
|
import { bls12_381 } from '@noble/curves/bls12-381';
|
|
93
|
-
import { bn254 } from '@noble/curves/
|
|
93
|
+
import { bn254 } from '@noble/curves/bn254';
|
|
94
94
|
import { jubjub } from '@noble/curves/jubjub';
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
Recovering public keys from weierstrass ECDSA signatures; using ECDH:
|
|
98
98
|
|
|
99
99
|
```ts
|
|
100
100
|
// extraEntropy https://moderncrypto.org/mail-archive/curves/2017/000925.html
|
|
@@ -104,7 +104,7 @@ const someonesPub = secp256k1.getPublicKey(secp256k1.utils.randomPrivateKey());
|
|
|
104
104
|
const shared = secp256k1.getSharedSecret(priv, someonesPub); // ECDH
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
Schnorr signatures over secp256k1 following
|
|
108
108
|
[BIP340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki):
|
|
109
109
|
|
|
110
110
|
```ts
|
|
@@ -118,10 +118,19 @@ const isValid = schnorr.verify(sig, msg, pub);
|
|
|
118
118
|
|
|
119
119
|
ed25519 module has ed25519ctx / ed25519ph variants,
|
|
120
120
|
x25519 ECDH and [ristretto255](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-ristretto255-decaf448).
|
|
121
|
-
|
|
121
|
+
|
|
122
|
+
Default `verify` behavior follows [ZIP215](https://zips.z.cash/zip-0215) and
|
|
123
|
+
[can be used in consensus-critical applications](https://hdevalence.ca/blog/2020-10-04-its-25519am).
|
|
124
|
+
`zip215: false` option switches verification criteria to RFC8032 / FIPS 186-5.
|
|
122
125
|
|
|
123
126
|
```ts
|
|
124
127
|
import { ed25519 } from '@noble/curves/ed25519';
|
|
128
|
+
const priv = ed25519.utils.randomPrivateKey();
|
|
129
|
+
const pub = ed25519.getPublicKey(priv);
|
|
130
|
+
const msg = new TextEncoder().encode('hello');
|
|
131
|
+
const sig = ed25519.sign(msg, priv);
|
|
132
|
+
ed25519.verify(sig, msg, pub); // Default mode: follows ZIP215
|
|
133
|
+
ed25519.verify(sig, msg, pub, { zip215: false }); // RFC8032 / FIPS 186-5
|
|
125
134
|
|
|
126
135
|
// Variants from RFC8032: with context, prehashed
|
|
127
136
|
import { ed25519ctx, ed25519ph } from '@noble/curves/ed25519';
|
|
@@ -152,53 +161,13 @@ import { hashToCurve, encodeToCurve } from '@noble/curves/ed448';
|
|
|
152
161
|
ed448.getPublicKey(ed448.utils.randomPrivateKey());
|
|
153
162
|
```
|
|
154
163
|
|
|
155
|
-
Every curve has
|
|
164
|
+
Every curve has `CURVE` object that contains its parameters, field, and others:
|
|
156
165
|
|
|
157
166
|
```ts
|
|
158
167
|
import { secp256k1 } from '@noble/curves/secp256k1'; // ESM and Common.js
|
|
159
168
|
console.log(secp256k1.CURVE.p, secp256k1.CURVE.n, secp256k1.CURVE.a, secp256k1.CURVE.b);
|
|
160
169
|
```
|
|
161
170
|
|
|
162
|
-
BLS12-381 pairing-friendly Barreto-Lynn-Scott elliptic curve construction allows to
|
|
163
|
-
construct [zk-SNARKs](https://z.cash/technology/zksnarks/) at the 128-bit security
|
|
164
|
-
and use aggregated, batch-verifiable
|
|
165
|
-
[threshold signatures](https://medium.com/snigirev.stepan/bls-signatures-better-than-schnorr-5a7fe30ea716),
|
|
166
|
-
using Boneh-Lynn-Shacham signature scheme. Compatible with ETH and others,
|
|
167
|
-
just make sure to provide correct DST (domain separation tag argument).
|
|
168
|
-
|
|
169
|
-
```ts
|
|
170
|
-
import { bls12_381 as bls } from '@noble/curves/bls12-381';
|
|
171
|
-
const privateKey = '67d53f170b908cabb9eb326c3c337762d59289a8fec79f7bc9254b584b73265c';
|
|
172
|
-
const message = '64726e3da8';
|
|
173
|
-
const publicKey = bls.getPublicKey(privateKey);
|
|
174
|
-
const signature = bls.sign(message, privateKey);
|
|
175
|
-
const isValid = bls.verify(signature, message, publicKey);
|
|
176
|
-
console.log({ publicKey, signature, isValid });
|
|
177
|
-
|
|
178
|
-
// Sign 1 msg with 3 keys
|
|
179
|
-
const privateKeys = [
|
|
180
|
-
'18f020b98eb798752a50ed0563b079c125b0db5dd0b1060d1c1b47d4a193e1e4',
|
|
181
|
-
'ed69a8c50cf8c9836be3b67c7eeff416612d45ba39a5c099d48fa668bf558c9c',
|
|
182
|
-
'16ae669f3be7a2121e17d0c68c05a8f3d6bef21ec0f2315f1d7aec12484e4cf5',
|
|
183
|
-
];
|
|
184
|
-
const messages = ['d2', '0d98', '05caf3'];
|
|
185
|
-
const publicKeys = privateKeys.map(bls.getPublicKey);
|
|
186
|
-
const signatures2 = privateKeys.map((p) => bls.sign(message, p));
|
|
187
|
-
const aggPubKey2 = bls.aggregatePublicKeys(publicKeys);
|
|
188
|
-
const aggSignature2 = bls.aggregateSignatures(signatures2);
|
|
189
|
-
const isValid2 = bls.verify(aggSignature2, message, aggPubKey2);
|
|
190
|
-
console.log({ signatures2, aggSignature2, isValid2 });
|
|
191
|
-
|
|
192
|
-
// Sign 3 msgs with 3 keys
|
|
193
|
-
const signatures3 = privateKeys.map((p, i) => bls.sign(messages[i], p));
|
|
194
|
-
const aggSignature3 = bls.aggregateSignatures(signatures3);
|
|
195
|
-
const isValid3 = bls.verifyBatch(aggSignature3, messages, publicKeys);
|
|
196
|
-
console.log({ publicKeys, signatures3, aggSignature3, isValid3 });
|
|
197
|
-
// bls.pairing(PointG1, PointG2) // pairings
|
|
198
|
-
|
|
199
|
-
// hash-to-curve examples can be seen below
|
|
200
|
-
```
|
|
201
|
-
|
|
202
171
|
## Abstract API
|
|
203
172
|
|
|
204
173
|
Abstract API allows to define custom curves. All arithmetics is done with JS
|
|
@@ -214,6 +183,7 @@ There are following zero-dependency algorithms:
|
|
|
214
183
|
- [abstract/weierstrass: Short Weierstrass curve](#abstractweierstrass-short-weierstrass-curve)
|
|
215
184
|
- [abstract/edwards: Twisted Edwards curve](#abstractedwards-twisted-edwards-curve)
|
|
216
185
|
- [abstract/montgomery: Montgomery curve](#abstractmontgomery-montgomery-curve)
|
|
186
|
+
- [abstract/bls: Barreto-Lynn-Scott curves](#abstractbls-barreto-lynn-scott-curves)
|
|
217
187
|
- [abstract/hash-to-curve: Hashing strings to curve points](#abstracthash-to-curve-hashing-strings-to-curve-points)
|
|
218
188
|
- [abstract/poseidon: Poseidon hash](#abstractposeidon-poseidon-hash)
|
|
219
189
|
- [abstract/modular: Modular arithmetics utilities](#abstractmodular-modular-arithmetics-utilities)
|
|
@@ -242,7 +212,7 @@ const secq256k1 = weierstrass({
|
|
|
242
212
|
randomBytes,
|
|
243
213
|
});
|
|
244
214
|
|
|
245
|
-
//
|
|
215
|
+
// Replace weierstrass with weierstrassPoints if you don't need ECDSA, hash, hmac, randomBytes
|
|
246
216
|
```
|
|
247
217
|
|
|
248
218
|
Short Weierstrass curve's formula is `y² = x³ + ax + b`. `weierstrass`
|
|
@@ -303,6 +273,8 @@ interface ProjPointType<T> extends Group<ProjPointType<T>> {
|
|
|
303
273
|
readonly px: T;
|
|
304
274
|
readonly py: T;
|
|
305
275
|
readonly pz: T;
|
|
276
|
+
get x(): bigint;
|
|
277
|
+
get y(): bigint;
|
|
306
278
|
multiply(scalar: bigint): ProjPointType<T>;
|
|
307
279
|
multiplyUnsafe(scalar: bigint): ProjPointType<T>;
|
|
308
280
|
multiplyAndAddUnsafe(Q: ProjPointType<T>, a: bigint, b: bigint): ProjPointType<T> | undefined;
|
|
@@ -388,7 +360,7 @@ import { randomBytes } from '@noble/hashes/utils';
|
|
|
388
360
|
|
|
389
361
|
const Fp = Field(2n ** 255n - 19n);
|
|
390
362
|
const ed25519 = twistedEdwards({
|
|
391
|
-
a: -1n,
|
|
363
|
+
a: Fp.create(-1n),
|
|
392
364
|
d: Fp.div(-121665n, 121666n), // -121665n/121666n mod p
|
|
393
365
|
Fp: Fp,
|
|
394
366
|
n: 2n ** 252n + 27742317777372353535851937790883648493n,
|
|
@@ -447,6 +419,8 @@ interface ExtPointType extends Group<ExtPointType> {
|
|
|
447
419
|
readonly ey: bigint;
|
|
448
420
|
readonly ez: bigint;
|
|
449
421
|
readonly et: bigint;
|
|
422
|
+
get x(): bigint;
|
|
423
|
+
get y(): bigint;
|
|
450
424
|
assertValidity(): void;
|
|
451
425
|
multiply(scalar: bigint): ExtPointType;
|
|
452
426
|
multiplyUnsafe(scalar: bigint): ExtPointType;
|
|
@@ -454,6 +428,8 @@ interface ExtPointType extends Group<ExtPointType> {
|
|
|
454
428
|
isTorsionFree(): boolean;
|
|
455
429
|
clearCofactor(): ExtPointType;
|
|
456
430
|
toAffine(iz?: bigint): AffinePoint<bigint>;
|
|
431
|
+
toRawBytes(isCompressed?: boolean): Uint8Array;
|
|
432
|
+
toHex(isCompressed?: boolean): string;
|
|
457
433
|
}
|
|
458
434
|
// Static methods of Extended Point with coordinates in X, Y, Z, T
|
|
459
435
|
interface ExtPointConstructor extends GroupConstructor<ExtPointType> {
|
|
@@ -491,6 +467,114 @@ Proper Elliptic Curve Points are not implemented yet.
|
|
|
491
467
|
|
|
492
468
|
You must specify curve params `Fp`, `a`, `Gu` coordinate of u, `montgomeryBits` and `nByteLength`.
|
|
493
469
|
|
|
470
|
+
### abstract/bls: Barreto-Lynn-Scott curves
|
|
471
|
+
|
|
472
|
+
The module abstracts BLS (Barreto-Lynn-Scott) pairing-friendly elliptic curve construction.
|
|
473
|
+
They allow to construct [zk-SNARKs](https://z.cash/technology/zksnarks/) and
|
|
474
|
+
use aggregated, batch-verifiable
|
|
475
|
+
[threshold signatures](https://medium.com/snigirev.stepan/bls-signatures-better-than-schnorr-5a7fe30ea716),
|
|
476
|
+
using Boneh-Lynn-Shacham signature scheme.
|
|
477
|
+
|
|
478
|
+
Main methods and properties are:
|
|
479
|
+
|
|
480
|
+
- `getPublicKey(privateKey)`
|
|
481
|
+
- `sign(message, privateKey)`
|
|
482
|
+
- `verify(signature, message, publicKey)`
|
|
483
|
+
- `aggregatePublicKeys(publicKeys)`
|
|
484
|
+
- `aggregateSignatures(signatures)`
|
|
485
|
+
- `G1` and `G2` curves containing `CURVE` and `ProjectivePoint`
|
|
486
|
+
- `Signature` property with `fromHex`, `toHex` methods
|
|
487
|
+
- `fields` containing `Fp`, `Fp2`, `Fp6`, `Fp12`, `Fr`
|
|
488
|
+
|
|
489
|
+
Right now we only implement BLS12-381 (compatible with ETH and others),
|
|
490
|
+
but in theory defining BLS12-377, BLS24 should be straightforward. An example:
|
|
491
|
+
|
|
492
|
+
```ts
|
|
493
|
+
import { bls12_381 as bls } from '@noble/curves/bls12-381';
|
|
494
|
+
const privateKey = '67d53f170b908cabb9eb326c3c337762d59289a8fec79f7bc9254b584b73265c';
|
|
495
|
+
const message = '64726e3da8';
|
|
496
|
+
const publicKey = bls.getPublicKey(privateKey);
|
|
497
|
+
const signature = bls.sign(message, privateKey);
|
|
498
|
+
const isValid = bls.verify(signature, message, publicKey);
|
|
499
|
+
console.log({ publicKey, signature, isValid });
|
|
500
|
+
|
|
501
|
+
// Sign 1 msg with 3 keys
|
|
502
|
+
const privateKeys = [
|
|
503
|
+
'18f020b98eb798752a50ed0563b079c125b0db5dd0b1060d1c1b47d4a193e1e4',
|
|
504
|
+
'ed69a8c50cf8c9836be3b67c7eeff416612d45ba39a5c099d48fa668bf558c9c',
|
|
505
|
+
'16ae669f3be7a2121e17d0c68c05a8f3d6bef21ec0f2315f1d7aec12484e4cf5',
|
|
506
|
+
];
|
|
507
|
+
const messages = ['d2', '0d98', '05caf3'];
|
|
508
|
+
const publicKeys = privateKeys.map(bls.getPublicKey);
|
|
509
|
+
const signatures2 = privateKeys.map((p) => bls.sign(message, p));
|
|
510
|
+
const aggPubKey2 = bls.aggregatePublicKeys(publicKeys);
|
|
511
|
+
const aggSignature2 = bls.aggregateSignatures(signatures2);
|
|
512
|
+
const isValid2 = bls.verify(aggSignature2, message, aggPubKey2);
|
|
513
|
+
console.log({ signatures2, aggSignature2, isValid2 });
|
|
514
|
+
|
|
515
|
+
// Sign 3 msgs with 3 keys
|
|
516
|
+
const signatures3 = privateKeys.map((p, i) => bls.sign(messages[i], p));
|
|
517
|
+
const aggSignature3 = bls.aggregateSignatures(signatures3);
|
|
518
|
+
const isValid3 = bls.verifyBatch(aggSignature3, messages, publicKeys);
|
|
519
|
+
console.log({ publicKeys, signatures3, aggSignature3, isValid3 });
|
|
520
|
+
|
|
521
|
+
// bls.pairing(PointG1, PointG2) // pairings
|
|
522
|
+
// bls.G1.ProjectivePoint.BASE, bls.G2.ProjectivePoint.BASE
|
|
523
|
+
// bls.fields.Fp, bls.fields.Fp2, bls.fields.Fp12, bls.fields.Fr
|
|
524
|
+
|
|
525
|
+
// hash-to-curve examples can be seen below
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
Full types:
|
|
529
|
+
|
|
530
|
+
```ts
|
|
531
|
+
getPublicKey: (privateKey: PrivKey) => Uint8Array;
|
|
532
|
+
sign: {
|
|
533
|
+
(message: Hex, privateKey: PrivKey): Uint8Array;
|
|
534
|
+
(message: ProjPointType<Fp2>, privateKey: PrivKey): ProjPointType<Fp2>;
|
|
535
|
+
};
|
|
536
|
+
verify: (
|
|
537
|
+
signature: Hex | ProjPointType<Fp2>,
|
|
538
|
+
message: Hex | ProjPointType<Fp2>,
|
|
539
|
+
publicKey: Hex | ProjPointType<Fp>
|
|
540
|
+
) => boolean;
|
|
541
|
+
verifyBatch: (
|
|
542
|
+
signature: Hex | ProjPointType<Fp2>,
|
|
543
|
+
messages: (Hex | ProjPointType<Fp2>)[],
|
|
544
|
+
publicKeys: (Hex | ProjPointType<Fp>)[]
|
|
545
|
+
) => boolean;
|
|
546
|
+
aggregatePublicKeys: {
|
|
547
|
+
(publicKeys: Hex[]): Uint8Array;
|
|
548
|
+
(publicKeys: ProjPointType<Fp>[]): ProjPointType<Fp>;
|
|
549
|
+
};
|
|
550
|
+
aggregateSignatures: {
|
|
551
|
+
(signatures: Hex[]): Uint8Array;
|
|
552
|
+
(signatures: ProjPointType<Fp2>[]): ProjPointType<Fp2>;
|
|
553
|
+
};
|
|
554
|
+
millerLoop: (ell: [Fp2, Fp2, Fp2][], g1: [Fp, Fp]) => Fp12;
|
|
555
|
+
pairing: (P: ProjPointType<Fp>, Q: ProjPointType<Fp2>, withFinalExponent?: boolean) => Fp12;
|
|
556
|
+
G1: CurvePointsRes<Fp> & ReturnType<typeof htf.createHasher<Fp>>;
|
|
557
|
+
G2: CurvePointsRes<Fp2> & ReturnType<typeof htf.createHasher<Fp2>>;
|
|
558
|
+
Signature: SignatureCoder<Fp2>;
|
|
559
|
+
params: {
|
|
560
|
+
x: bigint;
|
|
561
|
+
r: bigint;
|
|
562
|
+
G1b: bigint;
|
|
563
|
+
G2b: Fp2;
|
|
564
|
+
};
|
|
565
|
+
fields: {
|
|
566
|
+
Fp: IField<Fp>;
|
|
567
|
+
Fp2: IField<Fp2>;
|
|
568
|
+
Fp6: IField<Fp6>;
|
|
569
|
+
Fp12: IField<Fp12>;
|
|
570
|
+
Fr: IField<bigint>;
|
|
571
|
+
};
|
|
572
|
+
utils: {
|
|
573
|
+
randomPrivateKey: () => Uint8Array;
|
|
574
|
+
calcPairingPrecomputes: (p: AffinePoint<Fp2>) => [Fp2, Fp2, Fp2][];
|
|
575
|
+
};
|
|
576
|
+
```
|
|
577
|
+
|
|
494
578
|
### abstract/hash-to-curve: Hashing strings to curve points
|
|
495
579
|
|
|
496
580
|
The module allows to hash arbitrary strings to elliptic curve points. Implements [hash-to-curve v16](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-16).
|
|
@@ -589,11 +673,6 @@ type PoseidonOpts = {
|
|
|
589
673
|
const instance = poseidon(opts: PoseidonOpts);
|
|
590
674
|
```
|
|
591
675
|
|
|
592
|
-
### abstract/bls
|
|
593
|
-
|
|
594
|
-
The module abstracts BLS (Barreto-Lynn-Scott) primitives. In theory you should be able to write BLS12-377, BLS24,
|
|
595
|
-
and others with it.
|
|
596
|
-
|
|
597
676
|
### abstract/modular: Modular arithmetics utilities
|
|
598
677
|
|
|
599
678
|
```ts
|
|
@@ -640,12 +719,14 @@ import * as utils from '@noble/curves/abstract/utils';
|
|
|
640
719
|
|
|
641
720
|
utils.bytesToHex(Uint8Array.from([0xde, 0xad, 0xbe, 0xef]));
|
|
642
721
|
utils.hexToBytes('deadbeef');
|
|
722
|
+
utils.numberToHexUnpadded(123n);
|
|
643
723
|
utils.hexToNumber();
|
|
724
|
+
|
|
644
725
|
utils.bytesToNumberBE(Uint8Array.from([0xde, 0xad, 0xbe, 0xef]));
|
|
645
726
|
utils.bytesToNumberLE(Uint8Array.from([0xde, 0xad, 0xbe, 0xef]));
|
|
646
727
|
utils.numberToBytesBE(123n, 32);
|
|
647
728
|
utils.numberToBytesLE(123n, 64);
|
|
648
|
-
|
|
729
|
+
|
|
649
730
|
utils.concatBytes(Uint8Array.from([0xde, 0xad]), Uint8Array.from([0xbe, 0xef]));
|
|
650
731
|
utils.nLength(255n);
|
|
651
732
|
utils.equalBytes(Uint8Array.from([0xde]), Uint8Array.from([0xde]));
|
|
@@ -676,7 +757,7 @@ Benchmark results on Apple M2 with node v19:
|
|
|
676
757
|
secp256k1
|
|
677
758
|
init x 58 ops/sec @ 17ms/op
|
|
678
759
|
getPublicKey x 5,640 ops/sec @ 177μs/op
|
|
679
|
-
sign x
|
|
760
|
+
sign x 4,471 ops/sec @ 223μs/op
|
|
680
761
|
verify x 780 ops/sec @ 1ms/op
|
|
681
762
|
getSharedSecret x 465 ops/sec @ 2ms/op
|
|
682
763
|
recoverPublicKey x 740 ops/sec @ 1ms/op
|
|
@@ -686,19 +767,19 @@ schnorr.verify x 775 ops/sec @ 1ms/op
|
|
|
686
767
|
P256
|
|
687
768
|
init x 31 ops/sec @ 31ms/op
|
|
688
769
|
getPublicKey x 5,607 ops/sec @ 178μs/op
|
|
689
|
-
sign x
|
|
770
|
+
sign x 4,583 ops/sec @ 218μs/op
|
|
690
771
|
verify x 540 ops/sec @ 1ms/op
|
|
691
772
|
|
|
692
773
|
P384
|
|
693
774
|
init x 15 ops/sec @ 63ms/op
|
|
694
775
|
getPublicKey x 2,622 ops/sec @ 381μs/op
|
|
695
|
-
sign x
|
|
776
|
+
sign x 2,106 ops/sec @ 474μs/op
|
|
696
777
|
verify x 222 ops/sec @ 4ms/op
|
|
697
778
|
|
|
698
779
|
P521
|
|
699
780
|
init x 8 ops/sec @ 119ms/op
|
|
700
781
|
getPublicKey x 1,371 ops/sec @ 729μs/op
|
|
701
|
-
sign x 1,
|
|
782
|
+
sign x 1,164 ops/sec @ 858μs/op
|
|
702
783
|
verify x 118 ops/sec @ 8ms/op
|
|
703
784
|
|
|
704
785
|
ed25519
|
|
@@ -737,13 +818,12 @@ aggregateSignatures/128 x 3 ops/sec @ 332ms/opp
|
|
|
737
818
|
|
|
738
819
|
hash-to-curve
|
|
739
820
|
hash_to_field x 850,340 ops/sec @ 1μs/op
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
└─ed448 x 1,045 ops/sec @ 956μs/op
|
|
821
|
+
secp256k1 x 2,143 ops/sec @ 466μs/op
|
|
822
|
+
P256 x 3,861 ops/sec @ 258μs/op
|
|
823
|
+
P384 x 1,526 ops/sec @ 655μs/op
|
|
824
|
+
P521 x 748 ops/sec @ 1ms/op
|
|
825
|
+
ed25519 x 2,772 ops/sec @ 360μs/op
|
|
826
|
+
ed448 x 1,146 ops/sec @ 871μs/op
|
|
747
827
|
```
|
|
748
828
|
|
|
749
829
|
## Contributing & testing
|
|
@@ -753,24 +833,6 @@ hashToCurve
|
|
|
753
833
|
3. `npm run build` to compile TypeScript code
|
|
754
834
|
4. `npm run test` will execute all main tests
|
|
755
835
|
|
|
756
|
-
## Resources
|
|
757
|
-
|
|
758
|
-
Article about some of library's features: [Learning fast elliptic-curve cryptography](https://paulmillr.com/posts/noble-secp256k1-fast-ecc/)
|
|
759
|
-
|
|
760
|
-
Projects using the library:
|
|
761
|
-
|
|
762
|
-
- secp256k1
|
|
763
|
-
- [btc-signer](https://github.com/paulmillr/scure-btc-signer), [eth-signer](https://github.com/paulmillr/micro-eth-signer)
|
|
764
|
-
- ed25519
|
|
765
|
-
- [sol-signer](https://github.com/paulmillr/micro-sol-signer)
|
|
766
|
-
- BLS12-381
|
|
767
|
-
- Check out `bls12-381.ts` for articles about the curve
|
|
768
|
-
- Threshold sigs demo [genthresh.com](https://genthresh.com)
|
|
769
|
-
- BBS signatures [github.com/Wind4Greg/BBS-Draft-Checks](https://github.com/Wind4Greg/BBS-Draft-Checks) following [draft-irtf-cfrg-bbs-signatures-latest](https://identity.foundation/bbs-signature/draft-irtf-cfrg-bbs-signatures.html)
|
|
770
|
-
- Others
|
|
771
|
-
- All curves demo: Elliptic curve calculator [paulmillr.com/noble](https://paulmillr.com/noble)
|
|
772
|
-
- [micro-starknet](https://github.com/paulmillr/micro-starknet) for stark-friendly elliptic curve.
|
|
773
|
-
|
|
774
836
|
## Upgrading
|
|
775
837
|
|
|
776
838
|
Previously, the library was split into single-feature packages
|
|
@@ -778,6 +840,8 @@ noble-secp256k1 and noble-ed25519. curves can be thought as a continuation of th
|
|
|
778
840
|
original work. The libraries now changed their direction towards providing
|
|
779
841
|
minimal 4kb implementations of cryptography and are not as feature-complete.
|
|
780
842
|
|
|
843
|
+
Upgrading from @noble/secp256k1 2.0 or @noble/ed25519 2.0: no changes, libraries are compatible.
|
|
844
|
+
|
|
781
845
|
Upgrading from [@noble/secp256k1](https://github.com/paulmillr/noble-secp256k1) 1.7:
|
|
782
846
|
|
|
783
847
|
- `getPublicKey`
|
|
@@ -815,6 +879,40 @@ Upgrading from [@noble/ed25519](https://github.com/paulmillr/noble-ed25519) 1.7:
|
|
|
815
879
|
`etc` (`sha512Sync` and others)
|
|
816
880
|
- `getSharedSecret` was moved to `x25519` module
|
|
817
881
|
|
|
882
|
+
Upgrading from [@noble/bls12-381](https://github.com/paulmillr/noble-bls12-381):
|
|
883
|
+
|
|
884
|
+
- Methods and classes were renamed:
|
|
885
|
+
- PointG1 -> G1.Point, PointG2 -> G2.Point
|
|
886
|
+
- PointG2.fromSignature -> Signature.decode, PointG2.toSignature -> Signature.encode
|
|
887
|
+
- Fp2 ORDER was corrected
|
|
888
|
+
|
|
889
|
+
## Resources
|
|
890
|
+
|
|
891
|
+
Useful articles about the library or its primitives:
|
|
892
|
+
|
|
893
|
+
- [Learning fast elliptic-curve cryptography](https://paulmillr.com/posts/noble-secp256k1-fast-ecc/)
|
|
894
|
+
- Pairings and BLS
|
|
895
|
+
- [BLS12-381 for the rest of us](https://hackmd.io/@benjaminion/bls12-381)
|
|
896
|
+
- [Key concepts of pairings](https://medium.com/@alonmuroch_65570/bls-signatures-part-2-key-concepts-of-pairings-27a8a9533d0c)
|
|
897
|
+
- Pairing over bls12-381:
|
|
898
|
+
[part 1](https://research.nccgroup.com/2020/07/06/pairing-over-bls12-381-part-1-fields/),
|
|
899
|
+
[part 2](https://research.nccgroup.com/2020/07/13/pairing-over-bls12-381-part-2-curves/),
|
|
900
|
+
[part 3](https://research.nccgroup.com/2020/08/13/pairing-over-bls12-381-part-3-pairing/)
|
|
901
|
+
- [Estimating the bit security of pairing-friendly curves](https://research.nccgroup.com/2022/02/03/estimating-the-bit-security-of-pairing-friendly-curves/)
|
|
902
|
+
|
|
903
|
+
Real-world software that uses curves:
|
|
904
|
+
|
|
905
|
+
- [Elliptic Curve Calculator](https://paulmillr.com/noble) online demo: add / multiply points, sign messages
|
|
906
|
+
- Signers for web3 projects:
|
|
907
|
+
[btc-signer](https://github.com/paulmillr/scure-btc-signer), [eth-signer](https://github.com/paulmillr/micro-eth-signer),
|
|
908
|
+
[sol-signer](https://github.com/paulmillr/micro-sol-signer) for Solana
|
|
909
|
+
- [scure-bip32](https://github.com/paulmillr/scure-bip32) and separate [bip32](https://github.com/bitcoinjs/bip32) HDkey libraries
|
|
910
|
+
- [ed25519-keygen](https://github.com/paulmillr/ed25519-keygen) SSH, PGP, TOR key generation
|
|
911
|
+
- [micro-starknet](https://github.com/paulmillr/micro-starknet) stark-friendly elliptic curve algorithms.
|
|
912
|
+
- BLS threshold sigs demo [genthresh.com](https://genthresh.com)
|
|
913
|
+
- BLS BBS signatures [github.com/Wind4Greg/BBS-Draft-Checks](https://github.com/Wind4Greg/BBS-Draft-Checks) following [draft-irtf-cfrg-bbs-signatures-latest](https://identity.foundation/bbs-signature/draft-irtf-cfrg-bbs-signatures.html)
|
|
914
|
+
- [KZG trusted setup ceremony](https://github.com/dsrvlabs/czg-keremony)
|
|
915
|
+
|
|
818
916
|
## License
|
|
819
917
|
|
|
820
918
|
The MIT License (MIT)
|
package/abstract/bls.d.ts
CHANGED
|
@@ -18,11 +18,11 @@ import * as htf from './hash-to-curve.js';
|
|
|
18
18
|
import { CurvePointsType, ProjPointType as ProjPointType, CurvePointsRes } from './weierstrass.js';
|
|
19
19
|
type Fp = bigint;
|
|
20
20
|
export type SignatureCoder<Fp2> = {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
fromHex(hex: Hex): ProjPointType<Fp2>;
|
|
22
|
+
toRawBytes(point: ProjPointType<Fp2>): Uint8Array;
|
|
23
|
+
toHex(point: ProjPointType<Fp2>): string;
|
|
23
24
|
};
|
|
24
25
|
export type CurveType<Fp, Fp2, Fp6, Fp12> = {
|
|
25
|
-
r: bigint;
|
|
26
26
|
G1: Omit<CurvePointsType<Fp>, 'n'> & {
|
|
27
27
|
mapToCurve: htf.MapToCurve<Fp>;
|
|
28
28
|
htfDefaults: htf.Opts;
|
|
@@ -32,47 +32,41 @@ export type CurveType<Fp, Fp2, Fp6, Fp12> = {
|
|
|
32
32
|
mapToCurve: htf.MapToCurve<Fp2>;
|
|
33
33
|
htfDefaults: htf.Opts;
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
fields: {
|
|
36
|
+
Fp: IField<Fp>;
|
|
37
|
+
Fr: IField<bigint>;
|
|
38
|
+
Fp2: IField<Fp2> & {
|
|
39
|
+
reim: (num: Fp2) => {
|
|
40
|
+
re: bigint;
|
|
41
|
+
im: bigint;
|
|
42
|
+
};
|
|
43
|
+
multiplyByB: (num: Fp2) => Fp2;
|
|
44
|
+
frobeniusMap(num: Fp2, power: number): Fp2;
|
|
45
|
+
};
|
|
46
|
+
Fp6: IField<Fp6>;
|
|
47
|
+
Fp12: IField<Fp12> & {
|
|
48
|
+
frobeniusMap(num: Fp12, power: number): Fp12;
|
|
49
|
+
multiplyBy014(num: Fp12, o0: Fp2, o1: Fp2, o4: Fp2): Fp12;
|
|
50
|
+
conjugate(num: Fp12): Fp12;
|
|
51
|
+
finalExponentiate(num: Fp12): Fp12;
|
|
42
52
|
};
|
|
43
|
-
multiplyByB: (num: Fp2) => Fp2;
|
|
44
|
-
frobeniusMap(num: Fp2, power: number): Fp2;
|
|
45
53
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
multiplyBy014(num: Fp12, o0: Fp2, o1: Fp2, o4: Fp2): Fp12;
|
|
50
|
-
conjugate(num: Fp12): Fp12;
|
|
51
|
-
finalExponentiate(num: Fp12): Fp12;
|
|
54
|
+
params: {
|
|
55
|
+
x: bigint;
|
|
56
|
+
r: bigint;
|
|
52
57
|
};
|
|
53
58
|
htfDefaults: htf.Opts;
|
|
54
59
|
hash: CHash;
|
|
55
60
|
randomBytes: (bytesLength?: number) => Uint8Array;
|
|
56
61
|
};
|
|
57
62
|
export type CurveFn<Fp, Fp2, Fp6, Fp12> = {
|
|
58
|
-
CURVE: CurveType<Fp, Fp2, Fp6, Fp12>;
|
|
59
|
-
Fr: IField<bigint>;
|
|
60
|
-
Fp: IField<Fp>;
|
|
61
|
-
Fp2: IField<Fp2>;
|
|
62
|
-
Fp6: IField<Fp6>;
|
|
63
|
-
Fp12: IField<Fp12>;
|
|
64
|
-
G1: CurvePointsRes<Fp> & ReturnType<typeof htf.createHasher<Fp>>;
|
|
65
|
-
G2: CurvePointsRes<Fp2> & ReturnType<typeof htf.createHasher<Fp2>>;
|
|
66
|
-
Signature: SignatureCoder<Fp2>;
|
|
67
|
-
millerLoop: (ell: [Fp2, Fp2, Fp2][], g1: [Fp, Fp]) => Fp12;
|
|
68
|
-
calcPairingPrecomputes: (p: AffinePoint<Fp2>) => [Fp2, Fp2, Fp2][];
|
|
69
|
-
pairing: (P: ProjPointType<Fp>, Q: ProjPointType<Fp2>, withFinalExponent?: boolean) => Fp12;
|
|
70
63
|
getPublicKey: (privateKey: PrivKey) => Uint8Array;
|
|
71
64
|
sign: {
|
|
72
65
|
(message: Hex, privateKey: PrivKey): Uint8Array;
|
|
73
66
|
(message: ProjPointType<Fp2>, privateKey: PrivKey): ProjPointType<Fp2>;
|
|
74
67
|
};
|
|
75
68
|
verify: (signature: Hex | ProjPointType<Fp2>, message: Hex | ProjPointType<Fp2>, publicKey: Hex | ProjPointType<Fp>) => boolean;
|
|
69
|
+
verifyBatch: (signature: Hex | ProjPointType<Fp2>, messages: (Hex | ProjPointType<Fp2>)[], publicKeys: (Hex | ProjPointType<Fp>)[]) => boolean;
|
|
76
70
|
aggregatePublicKeys: {
|
|
77
71
|
(publicKeys: Hex[]): Uint8Array;
|
|
78
72
|
(publicKeys: ProjPointType<Fp>[]): ProjPointType<Fp>;
|
|
@@ -81,9 +75,27 @@ export type CurveFn<Fp, Fp2, Fp6, Fp12> = {
|
|
|
81
75
|
(signatures: Hex[]): Uint8Array;
|
|
82
76
|
(signatures: ProjPointType<Fp2>[]): ProjPointType<Fp2>;
|
|
83
77
|
};
|
|
84
|
-
|
|
78
|
+
millerLoop: (ell: [Fp2, Fp2, Fp2][], g1: [Fp, Fp]) => Fp12;
|
|
79
|
+
pairing: (P: ProjPointType<Fp>, Q: ProjPointType<Fp2>, withFinalExponent?: boolean) => Fp12;
|
|
80
|
+
G1: CurvePointsRes<Fp> & ReturnType<typeof htf.createHasher<Fp>>;
|
|
81
|
+
G2: CurvePointsRes<Fp2> & ReturnType<typeof htf.createHasher<Fp2>>;
|
|
82
|
+
Signature: SignatureCoder<Fp2>;
|
|
83
|
+
params: {
|
|
84
|
+
x: bigint;
|
|
85
|
+
r: bigint;
|
|
86
|
+
G1b: bigint;
|
|
87
|
+
G2b: Fp2;
|
|
88
|
+
};
|
|
89
|
+
fields: {
|
|
90
|
+
Fp: IField<Fp>;
|
|
91
|
+
Fp2: IField<Fp2>;
|
|
92
|
+
Fp6: IField<Fp6>;
|
|
93
|
+
Fp12: IField<Fp12>;
|
|
94
|
+
Fr: IField<bigint>;
|
|
95
|
+
};
|
|
85
96
|
utils: {
|
|
86
97
|
randomPrivateKey: () => Uint8Array;
|
|
98
|
+
calcPairingPrecomputes: (p: AffinePoint<Fp2>) => [Fp2, Fp2, Fp2][];
|
|
87
99
|
};
|
|
88
100
|
};
|
|
89
101
|
export declare function bls<Fp2, Fp6, Fp12>(CURVE: CurveType<Fp, Fp2, Fp6, Fp12>): CurveFn<Fp, Fp2, Fp6, Fp12>;
|
package/abstract/bls.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bls.d.ts","sourceRoot":"","sources":["../src/abstract/bls.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAA+B,MAAM,YAAY,CAAC;AAC9E,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,aAAa,IAAI,aAAa,EAC9B,cAAc,EAEf,MAAM,kBAAkB,CAAC;AAE1B,KAA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