Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@noble/ed25519

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@noble/ed25519 - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

48

lib/esm/index.js

@@ -6,10 +6,9 @@ /*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */

const _2n = BigInt(2);
const _255n = BigInt(255);
const CURVE_ORDER = _2n ** BigInt(252) + BigInt('27742317777372353535851937790883648493');
const CU_O = BigInt('7237005577332262213973186563042994240857116359379907606001950938285454250989');
const CURVE = Object.freeze({
a: BigInt(-1),
d: BigInt('37095705934669439343138083508754565189542113879843219016388785533085940283555'),
P: _2n ** _255n - BigInt(19),
l: CURVE_ORDER,
n: CURVE_ORDER,
P: BigInt('57896044618658097711785492504343953926634992332820282019728792003956564819949'),
l: CU_O,
n: CU_O,
h: BigInt(8),

@@ -20,3 +19,3 @@ Gx: BigInt('15112221349535400772501151409588531511454012693041857206046113283949847762202'),

export { CURVE };
const MAX_256B = _2n ** BigInt(256);
const POW_2_256 = BigInt('0x10000000000000000000000000000000000000000000000000000000000000000');
const SQRT_M1 = BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752');

@@ -66,7 +65,8 @@ const SQRT_D = BigInt('6853475219497561581579357271197624642482790079785650197046958215289687604742');

const { a } = CURVE;
const A = mod(X1 ** _2n);
const B = mod(Y1 ** _2n);
const C = mod(_2n * mod(Z1 ** _2n));
const A = mod(X1 * X1);
const B = mod(Y1 * Y1);
const C = mod(_2n * mod(Z1 * Z1));
const D = mod(a * A);
const E = mod(mod((X1 + Y1) ** _2n) - A - B);
const x1y1 = X1 + Y1;
const E = mod(mod(x1y1 * x1y1) - A - B);
const G = D + B;

@@ -289,3 +289,4 @@ const F = G - C;

const u2 = mod(x * y);
const { value: invsqrt } = invertSqrt(mod(u1 * u2 ** _2n));
const u2sq = mod(u2 * u2);
const { value: invsqrt } = invertSqrt(mod(u1 * u2sq));
const D1 = mod(invsqrt * u1);

@@ -361,3 +362,3 @@ const D2 = mod(invsqrt * u2);

throw new Error('Expected 0 < hex < P');
if (!strict && y >= MAX_256B)
if (!strict && y >= POW_2_256)
throw new Error('Expected 0 < hex < 2**256');

@@ -501,4 +502,5 @@ const y2 = mod(y * y);

}
const MAX_255B = BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
function bytes255ToNumberLE(bytes) {
return mod(bytesToNumberLE(bytes) & (_2n ** _255n - _1n));
return mod(bytesToNumberLE(bytes) & MAX_255B);
}

@@ -646,3 +648,3 @@ function mod(a, b = CURVE.P) {

typeof key === 'bigint' || typeof key === 'number'
? numberTo32BytesBE(normalizeScalar(key, MAX_256B))
? numberTo32BytesBE(normalizeScalar(key, POW_2_256))
: ensureBytes(key);

@@ -770,4 +772,6 @@ if (key.length !== 32)

const CB = mod(C * B);
x_3 = mod((DA + CB) ** _2n);
z_3 = mod(x_1 * (DA - CB) ** _2n);
const dacb = DA + CB;
const da_cb = DA - CB;
x_3 = mod(dacb * dacb);
z_3 = mod(x_1 * mod(da_cb * da_cb));
x_2 = mod(AA * BB);

@@ -813,2 +817,8 @@ z_2 = mod(E * (AA + mod(a24 * E)));

export const utils = {
bytesToHex,
hexToBytes,
concatBytes,
getExtendedPublicKey,
mod,
invert,
TORSION_SUBGROUP: [

@@ -824,8 +834,2 @@ '0100000000000000000000000000000000000000000000000000000000000000',

],
bytesToHex,
hexToBytes,
concatBytes,
getExtendedPublicKey,
mod,
invert,
hashToPrivateScalar: (hash) => {

@@ -832,0 +836,0 @@ hash = ensureBytes(hash);

@@ -130,3 +130,2 @@ /*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */

export declare const utils: {
TORSION_SUBGROUP: string[];
bytesToHex: typeof bytesToHex;

@@ -138,2 +137,3 @@ hexToBytes: typeof hexToBytes;

invert: typeof invert;
TORSION_SUBGROUP: string[];
hashToPrivateScalar: (hash: Hex) => bigint;

@@ -140,0 +140,0 @@ randomBytes: (bytesLength?: number) => Uint8Array;

@@ -9,10 +9,9 @@ "use strict";

const _2n = BigInt(2);
const _255n = BigInt(255);
const CURVE_ORDER = _2n ** BigInt(252) + BigInt('27742317777372353535851937790883648493');
const CU_O = BigInt('7237005577332262213973186563042994240857116359379907606001950938285454250989');
const CURVE = Object.freeze({
a: BigInt(-1),
d: BigInt('37095705934669439343138083508754565189542113879843219016388785533085940283555'),
P: _2n ** _255n - BigInt(19),
l: CURVE_ORDER,
n: CURVE_ORDER,
P: BigInt('57896044618658097711785492504343953926634992332820282019728792003956564819949'),
l: CU_O,
n: CU_O,
h: BigInt(8),

@@ -23,3 +22,3 @@ Gx: BigInt('15112221349535400772501151409588531511454012693041857206046113283949847762202'),

exports.CURVE = CURVE;
const MAX_256B = _2n ** BigInt(256);
const POW_2_256 = BigInt('0x10000000000000000000000000000000000000000000000000000000000000000');
const SQRT_M1 = BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752');

@@ -69,7 +68,8 @@ const SQRT_D = BigInt('6853475219497561581579357271197624642482790079785650197046958215289687604742');

const { a } = CURVE;
const A = mod(X1 ** _2n);
const B = mod(Y1 ** _2n);
const C = mod(_2n * mod(Z1 ** _2n));
const A = mod(X1 * X1);
const B = mod(Y1 * Y1);
const C = mod(_2n * mod(Z1 * Z1));
const D = mod(a * A);
const E = mod(mod((X1 + Y1) ** _2n) - A - B);
const x1y1 = X1 + Y1;
const E = mod(mod(x1y1 * x1y1) - A - B);
const G = D + B;

@@ -293,3 +293,4 @@ const F = G - C;

const u2 = mod(x * y);
const { value: invsqrt } = invertSqrt(mod(u1 * u2 ** _2n));
const u2sq = mod(u2 * u2);
const { value: invsqrt } = invertSqrt(mod(u1 * u2sq));
const D1 = mod(invsqrt * u1);

@@ -366,3 +367,3 @@ const D2 = mod(invsqrt * u2);

throw new Error('Expected 0 < hex < P');
if (!strict && y >= MAX_256B)
if (!strict && y >= POW_2_256)
throw new Error('Expected 0 < hex < 2**256');

@@ -507,4 +508,5 @@ const y2 = mod(y * y);

}
const MAX_255B = BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
function bytes255ToNumberLE(bytes) {
return mod(bytesToNumberLE(bytes) & (_2n ** _255n - _1n));
return mod(bytesToNumberLE(bytes) & MAX_255B);
}

@@ -652,3 +654,3 @@ function mod(a, b = CURVE.P) {

typeof key === 'bigint' || typeof key === 'number'
? numberTo32BytesBE(normalizeScalar(key, MAX_256B))
? numberTo32BytesBE(normalizeScalar(key, POW_2_256))
: ensureBytes(key);

@@ -780,4 +782,6 @@ if (key.length !== 32)

const CB = mod(C * B);
x_3 = mod((DA + CB) ** _2n);
z_3 = mod(x_1 * (DA - CB) ** _2n);
const dacb = DA + CB;
const da_cb = DA - CB;
x_3 = mod(dacb * dacb);
z_3 = mod(x_1 * mod(da_cb * da_cb));
x_2 = mod(AA * BB);

@@ -823,2 +827,8 @@ z_2 = mod(E * (AA + mod(a24 * E)));

exports.utils = {
bytesToHex,
hexToBytes,
concatBytes,
getExtendedPublicKey,
mod,
invert,
TORSION_SUBGROUP: [

@@ -834,8 +844,2 @@ '0100000000000000000000000000000000000000000000000000000000000000',

],
bytesToHex,
hexToBytes,
concatBytes,
getExtendedPublicKey,
mod,
invert,
hashToPrivateScalar: (hash) => {

@@ -842,0 +846,0 @@ hash = ensureBytes(hash);

{
"name": "@noble/ed25519",
"version": "1.7.0",
"version": "1.7.1",
"description": "Fastest JS implementation of ed25519. Independently audited, high-security, 0-dependency EDDSA, X25519 ECDH & ristretto255",

@@ -5,0 +5,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc