@noble/ed25519
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -537,3 +537,3 @@ /*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */ | ||
function ensureBytes(hash) { | ||
return hash instanceof Uint8Array ? hash : hexToBytes(hash); | ||
return hash instanceof Uint8Array ? Uint8Array.from(hash) : hexToBytes(hash); | ||
} | ||
@@ -561,7 +561,6 @@ function assertLen(len, bytes) { | ||
assertLen(32, n); | ||
const _n = n.slice(); | ||
_n[0] &= 248; | ||
_n[31] &= 127; | ||
_n[31] |= 64; | ||
return bytesToNumberLE(_n); | ||
n[0] &= 248; | ||
n[31] &= 127; | ||
n[31] |= 64; | ||
return bytesToNumberLE(n); | ||
} | ||
@@ -626,3 +625,3 @@ async function getExtendedPublicKey(key) { | ||
for (let t = BigInt(255 - 1); t >= _0n; t--) { | ||
const k_t = (k >> t) & 1n; | ||
const k_t = (k >> t) & _1n; | ||
swap ^= k_t; | ||
@@ -645,4 +644,4 @@ sw = cswap(swap, x_2, x_3); | ||
const CB = mod(C * B); | ||
x_3 = mod(mod(DA + CB) ** 2n); | ||
z_3 = mod(x_1 * mod(DA - CB) ** 2n); | ||
x_3 = mod(mod(DA + CB) ** _2n); | ||
z_3 = mod(x_1 * mod(DA - CB) ** _2n); | ||
x_2 = mod(AA * BB); | ||
@@ -666,3 +665,3 @@ z_2 = mod(E * (AA + mod(a24 * E))); | ||
const pu = montgomeryLadder(u, p); | ||
if (pu === 0n) | ||
if (pu === _0n) | ||
throw new Error('Invalid private or public key received'); | ||
@@ -672,6 +671,6 @@ return encodeUCoordinate(pu); | ||
function decodeUCoordinate(uEnc) { | ||
const _s = ensureBytes(uEnc); | ||
assertLen(32, _s); | ||
_s[31] &= 127; | ||
return bytesToNumberLE(_s); | ||
const u = ensureBytes(uEnc); | ||
assertLen(32, u); | ||
u[31] &= 127; | ||
return bytesToNumberLE(u); | ||
} | ||
@@ -678,0 +677,0 @@ export const curve25519 = { |
@@ -545,3 +545,3 @@ "use strict"; | ||
function ensureBytes(hash) { | ||
return hash instanceof Uint8Array ? hash : hexToBytes(hash); | ||
return hash instanceof Uint8Array ? Uint8Array.from(hash) : hexToBytes(hash); | ||
} | ||
@@ -569,7 +569,6 @@ function assertLen(len, bytes) { | ||
assertLen(32, n); | ||
const _n = n.slice(); | ||
_n[0] &= 248; | ||
_n[31] &= 127; | ||
_n[31] |= 64; | ||
return bytesToNumberLE(_n); | ||
n[0] &= 248; | ||
n[31] &= 127; | ||
n[31] |= 64; | ||
return bytesToNumberLE(n); | ||
} | ||
@@ -638,3 +637,3 @@ async function getExtendedPublicKey(key) { | ||
for (let t = BigInt(255 - 1); t >= _0n; t--) { | ||
const k_t = (k >> t) & 1n; | ||
const k_t = (k >> t) & _1n; | ||
swap ^= k_t; | ||
@@ -657,4 +656,4 @@ sw = cswap(swap, x_2, x_3); | ||
const CB = mod(C * B); | ||
x_3 = mod(mod(DA + CB) ** 2n); | ||
z_3 = mod(x_1 * mod(DA - CB) ** 2n); | ||
x_3 = mod(mod(DA + CB) ** _2n); | ||
z_3 = mod(x_1 * mod(DA - CB) ** _2n); | ||
x_2 = mod(AA * BB); | ||
@@ -678,3 +677,3 @@ z_2 = mod(E * (AA + mod(a24 * E))); | ||
const pu = montgomeryLadder(u, p); | ||
if (pu === 0n) | ||
if (pu === _0n) | ||
throw new Error('Invalid private or public key received'); | ||
@@ -684,6 +683,6 @@ return encodeUCoordinate(pu); | ||
function decodeUCoordinate(uEnc) { | ||
const _s = ensureBytes(uEnc); | ||
assertLen(32, _s); | ||
_s[31] &= 127; | ||
return bytesToNumberLE(_s); | ||
const u = ensureBytes(uEnc); | ||
assertLen(32, u); | ||
u[31] &= 127; | ||
return bytesToNumberLE(u); | ||
} | ||
@@ -690,0 +689,0 @@ exports.curve25519 = { |
{ | ||
"name": "@noble/ed25519", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Fastest JS implementation of ed25519 & ristretto255. Auditable, high-security, 0-dependency EDDSA, X25519 ECDH & scalarmult", | ||
@@ -73,3 +73,9 @@ "files": [ | ||
"bail": 2 | ||
} | ||
}, | ||
"funding": [ | ||
{ | ||
"type": "individual", | ||
"url": "https://paulmillr.com/funding/" | ||
} | ||
] | ||
} |
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
68352
1571