@noble/curves
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -75,8 +75,2 @@ "use strict"; | ||
class Point { | ||
ex; | ||
ey; | ||
ez; | ||
et; | ||
static BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy)); | ||
static ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0 | ||
constructor(ex, ey, ez, et) { | ||
@@ -114,6 +108,2 @@ this.ex = ex; | ||
} | ||
// We calculate precomputes for elliptic curve point multiplication | ||
// using windowed method. This specifies window size and | ||
// stores precomputed values. Usually only base point would be precomputed. | ||
_WINDOW_SIZE; | ||
// "Private method", don't use it directly | ||
@@ -339,2 +329,4 @@ _setWindowSize(windowSize) { | ||
} | ||
Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy)); | ||
Point.ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0 | ||
const { BASE: G, ZERO: I } = Point; | ||
@@ -341,0 +333,0 @@ const wnaf = (0, curve_js_1.wNAF)(Point, nByteLength * 8); |
@@ -119,3 +119,2 @@ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ | ||
stack?: string; | ||
cause?: unknown; | ||
}; | ||
@@ -122,0 +121,0 @@ }; |
@@ -182,7 +182,2 @@ "use strict"; | ||
class Point { | ||
px; | ||
py; | ||
pz; | ||
static BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); | ||
static ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); | ||
constructor(px, py, pz) { | ||
@@ -242,6 +237,2 @@ this.px = px; | ||
} | ||
// We calculate precomputes for elliptic curve point multiplication | ||
// using windowed method. This specifies window size and | ||
// stores precomputed values. Usually only base point would be precomputed. | ||
_WINDOW_SIZE; | ||
// "Private method", don't use it directly | ||
@@ -528,2 +519,4 @@ _setWindowSize(windowSize) { | ||
} | ||
Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); | ||
Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); | ||
const _bits = CURVE.nBitLength; | ||
@@ -629,5 +622,2 @@ const wnaf = (0, curve_js_1.wNAF)(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits); | ||
class Signature { | ||
r; | ||
s; | ||
recovery; | ||
constructor(r, s, recovery) { | ||
@@ -634,0 +624,0 @@ this.r = r; |
@@ -866,18 +866,18 @@ "use strict"; | ||
bytes = bytes.slice(); | ||
const mask = bytes[0] & 0b1110_0000; | ||
const mask = bytes[0] & 224; | ||
const compressed = !!((mask >> 7) & 1); // compression bit (0b1000_0000) | ||
const infinity = !!((mask >> 6) & 1); // point at infinity bit (0b0100_0000) | ||
const sort = !!((mask >> 5) & 1); // sort bit (0b0010_0000) | ||
bytes[0] &= 0b0001_1111; // clear mask (zero first 3 bits) | ||
bytes[0] &= 31; // clear mask (zero first 3 bits) | ||
return { compressed, infinity, sort, value: bytes }; | ||
} | ||
function setMask(bytes, mask) { | ||
if (bytes[0] & 0b1110_0000) | ||
if (bytes[0] & 224) | ||
throw new Error('setMask: non-empty mask'); | ||
if (mask.compressed) | ||
bytes[0] |= 0b1000_0000; | ||
bytes[0] |= 128; | ||
if (mask.infinity) | ||
bytes[0] |= 0b0100_0000; | ||
bytes[0] |= 64; | ||
if (mask.sort) | ||
bytes[0] |= 0b0010_0000; | ||
bytes[0] |= 32; | ||
return bytes; | ||
@@ -1126,3 +1126,3 @@ } | ||
) { | ||
throw new Error('Invalid encoding flag: ' + (bytes[0] & 0b1110_0000)); | ||
throw new Error('Invalid encoding flag: ' + (bytes[0] & 224)); | ||
} | ||
@@ -1129,0 +1129,0 @@ const L = Fp.BYTES; |
@@ -300,5 +300,2 @@ "use strict"; | ||
class RistPoint { | ||
ep; | ||
static BASE; | ||
static ZERO; | ||
// Private property to discourage combining ExtendedPoint + RistrettoPoint | ||
@@ -305,0 +302,0 @@ // Always use Ristretto encoding/decoding instead. |
@@ -276,5 +276,2 @@ "use strict"; | ||
class DcfPoint { | ||
ep; | ||
static BASE; | ||
static ZERO; | ||
// Private property to discourage combining ExtendedPoint + DecafPoint | ||
@@ -281,0 +278,0 @@ // Always use Decaf encoding/decoding instead. |
@@ -72,8 +72,2 @@ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ | ||
class Point { | ||
ex; | ||
ey; | ||
ez; | ||
et; | ||
static BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy)); | ||
static ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0 | ||
constructor(ex, ey, ez, et) { | ||
@@ -111,6 +105,2 @@ this.ex = ex; | ||
} | ||
// We calculate precomputes for elliptic curve point multiplication | ||
// using windowed method. This specifies window size and | ||
// stores precomputed values. Usually only base point would be precomputed. | ||
_WINDOW_SIZE; | ||
// "Private method", don't use it directly | ||
@@ -336,2 +326,4 @@ _setWindowSize(windowSize) { | ||
} | ||
Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy)); | ||
Point.ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0 | ||
const { BASE: G, ZERO: I } = Point; | ||
@@ -338,0 +330,0 @@ const wnaf = wNAF(Point, nByteLength * 8); |
@@ -119,3 +119,2 @@ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ | ||
stack?: string; | ||
cause?: unknown; | ||
}; | ||
@@ -122,0 +121,0 @@ }; |
@@ -175,7 +175,2 @@ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ | ||
class Point { | ||
px; | ||
py; | ||
pz; | ||
static BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); | ||
static ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); | ||
constructor(px, py, pz) { | ||
@@ -235,6 +230,2 @@ this.px = px; | ||
} | ||
// We calculate precomputes for elliptic curve point multiplication | ||
// using windowed method. This specifies window size and | ||
// stores precomputed values. Usually only base point would be precomputed. | ||
_WINDOW_SIZE; | ||
// "Private method", don't use it directly | ||
@@ -521,2 +512,4 @@ _setWindowSize(windowSize) { | ||
} | ||
Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); | ||
Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); | ||
const _bits = CURVE.nBitLength; | ||
@@ -622,5 +615,2 @@ const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits); | ||
class Signature { | ||
r; | ||
s; | ||
recovery; | ||
constructor(r, s, recovery) { | ||
@@ -627,0 +617,0 @@ this.r = r; |
@@ -863,18 +863,18 @@ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ | ||
bytes = bytes.slice(); | ||
const mask = bytes[0] & 0b1110_0000; | ||
const mask = bytes[0] & 224; | ||
const compressed = !!((mask >> 7) & 1); // compression bit (0b1000_0000) | ||
const infinity = !!((mask >> 6) & 1); // point at infinity bit (0b0100_0000) | ||
const sort = !!((mask >> 5) & 1); // sort bit (0b0010_0000) | ||
bytes[0] &= 0b0001_1111; // clear mask (zero first 3 bits) | ||
bytes[0] &= 31; // clear mask (zero first 3 bits) | ||
return { compressed, infinity, sort, value: bytes }; | ||
} | ||
function setMask(bytes, mask) { | ||
if (bytes[0] & 0b1110_0000) | ||
if (bytes[0] & 224) | ||
throw new Error('setMask: non-empty mask'); | ||
if (mask.compressed) | ||
bytes[0] |= 0b1000_0000; | ||
bytes[0] |= 128; | ||
if (mask.infinity) | ||
bytes[0] |= 0b0100_0000; | ||
bytes[0] |= 64; | ||
if (mask.sort) | ||
bytes[0] |= 0b0010_0000; | ||
bytes[0] |= 32; | ||
return bytes; | ||
@@ -1123,3 +1123,3 @@ } | ||
) { | ||
throw new Error('Invalid encoding flag: ' + (bytes[0] & 0b1110_0000)); | ||
throw new Error('Invalid encoding flag: ' + (bytes[0] & 224)); | ||
} | ||
@@ -1126,0 +1126,0 @@ const L = Fp.BYTES; |
@@ -295,5 +295,2 @@ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ | ||
class RistPoint { | ||
ep; | ||
static BASE; | ||
static ZERO; | ||
// Private property to discourage combining ExtendedPoint + RistrettoPoint | ||
@@ -300,0 +297,0 @@ // Always use Ristretto encoding/decoding instead. |
@@ -272,5 +272,2 @@ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ | ||
class DcfPoint { | ||
ep; | ||
static BASE; | ||
static ZERO; | ||
// Private property to discourage combining ExtendedPoint + DecafPoint | ||
@@ -277,0 +274,0 @@ // Always use Decaf encoding/decoding instead. |
{ | ||
"name": "@noble/curves", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "Audited & minimal JS implementation of elliptic curve cryptography", | ||
@@ -34,3 +34,3 @@ "files": [ | ||
"devDependencies": { | ||
"@paulmillr/jsbt": "0.2.0", | ||
"@paulmillr/jsbt": "0.2.1", | ||
"fast-check": "3.0.0", | ||
@@ -138,5 +138,4 @@ "micro-bmark": "0.3.1", | ||
"cryptography", | ||
"weierstrass", | ||
"montgomery", | ||
"edwards", | ||
"secp256k1", | ||
"ed25519", | ||
"p256", | ||
@@ -146,4 +145,2 @@ "p384", | ||
"secp256r1", | ||
"secp256k1", | ||
"ed25519", | ||
"ed448", | ||
@@ -154,3 +151,2 @@ "x25519", | ||
"bn254", | ||
"pasta", | ||
"bls", | ||
@@ -161,2 +157,5 @@ "noble", | ||
"eddsa", | ||
"weierstrass", | ||
"montgomery", | ||
"edwards", | ||
"schnorr" | ||
@@ -163,0 +162,0 @@ ], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1498218
20796