New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@noble/curves

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@noble/curves - npm Package Compare versions

Comparing version 1.8.0 to 1.8.1

4

_shortw_utils.d.ts
import { randomBytes } from '@noble/hashes/utils';
import { CHash } from './abstract/utils.js';
import { CurveType, CurveFn } from './abstract/weierstrass.js';
import type { CHash } from './abstract/utils.js';
import { type CurveFn, type CurveType } from './abstract/weierstrass.js';
/** connects noble-curves to noble-hashes */

@@ -5,0 +5,0 @@ export declare function getHash(hash: CHash): {

@@ -19,7 +19,7 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { IField } from './modular.js';
import { Hex, PrivKey, CHash } from './utils.js';
import { MapToCurve, Opts as HTFOpts, htfBasicOpts, createHasher } from './hash-to-curve.js';
import { CurvePointsType, ProjPointType as ProjPointType, CurvePointsRes } from './weierstrass.js';
import type { Fp2, Fp6, Fp12, Fp2Bls, Fp12Bls } from './tower.js';
import { type IField } from './modular.js';
import { type CHash, type Hex, type PrivKey } from './utils.js';
import { type htfBasicOpts, type Opts as HTFOpts, type MapToCurve, createHasher } from './hash-to-curve.js';
import type { Fp12, Fp12Bls, Fp2, Fp2Bls, Fp6 } from './tower.js';
import { type CurvePointsRes, type CurvePointsType, type ProjPointType } from './weierstrass.js';
type Fp = bigint;

@@ -26,0 +26,0 @@ export type TwistType = 'multiplicative' | 'divisive';

@@ -7,3 +7,3 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { IField } from './modular.js';
import { type IField } from './modular.js';
export type AffinePoint<T> = {

@@ -10,0 +10,0 @@ x: T;

@@ -7,4 +7,4 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { AffinePoint, BasicCurve, Group, GroupConstructor } from './curve.js';
import { FHash, Hex } from './utils.js';
import { type AffinePoint, type BasicCurve, type Group, type GroupConstructor } from './curve.js';
import { type FHash, type Hex } from './utils.js';
/** Edwards curves must declare params a & d. */

@@ -11,0 +11,0 @@ export type CurveType = BasicCurve<bigint> & {

@@ -8,3 +8,3 @@ /**

import type { AffinePoint, Group, GroupConstructor } from './curve.js';
import { IField } from './modular.js';
import { type IField } from './modular.js';
import type { CHash } from './utils.js';

@@ -11,0 +11,0 @@ export type UnicodeOrBytes = string | Uint8Array;

@@ -10,3 +10,3 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { IField } from './modular.js';
import { type IField } from './modular.js';
export type PoseidonOpts = {

@@ -13,0 +13,0 @@ Fp: IField<bigint>;

@@ -28,5 +28,5 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { AffinePoint, BasicCurve, Group, GroupConstructor } from './curve.js';
import * as mod from './modular.js';
import { CHash, Hex, PrivKey } from './utils.js';
import { type AffinePoint, type BasicCurve, type Group, type GroupConstructor } from './curve.js';
import { type IField } from './modular.js';
import { type CHash, type Hex, type PrivKey } from './utils.js';
export type { AffinePoint };

@@ -210,3 +210,3 @@ type HmacFnSync = (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;

*/
export declare function SWUFpSqrtRatio<T>(Fp: mod.IField<T>, Z: T): (u: T, v: T) => {
export declare function SWUFpSqrtRatio<T>(Fp: IField<T>, Z: T): (u: T, v: T) => {
isValid: boolean;

@@ -219,3 +219,3 @@ value: T;

*/
export declare function mapToCurveSimpleSWU<T>(Fp: mod.IField<T>, opts: {
export declare function mapToCurveSimpleSWU<T>(Fp: IField<T>, opts: {
A: T;

@@ -222,0 +222,0 @@ B: T;

@@ -36,3 +36,3 @@ "use strict";

const curve_js_1 = require("./curve.js");
const mod = require("./modular.js");
const modular_js_1 = require("./modular.js");
const ut = require("./utils.js");

@@ -198,3 +198,3 @@ const utils_js_1 = require("./utils.js");

const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ
const Fn = mod.Field(CURVE.n, CURVE.nBitLength);
const Fn = (0, modular_js_1.Field)(CURVE.n, CURVE.nBitLength);
const toBytes = CURVE.toBytes ||

@@ -257,3 +257,3 @@ ((_c, point, _isCompressed) => {

if (wrapPrivateKey)
num = mod.mod(num, N); // disabled by default, enabled for BLS
num = (0, modular_js_1.mod)(num, N); // disabled by default, enabled for BLS
ut.aInRange('private key', num, _1n, N); // num in range [1..N-1]

@@ -665,6 +665,6 @@ return num;

function modN(a) {
return mod.mod(a, CURVE_ORDER);
return (0, modular_js_1.mod)(a, CURVE_ORDER);
}
function invN(a) {
return mod.invert(a, CURVE_ORDER);
return (0, modular_js_1.invert)(a, CURVE_ORDER);
}

@@ -818,4 +818,4 @@ const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({

randomPrivateKey: () => {
const length = mod.getMinHashLength(CURVE.n);
return mod.mapHashToField(CURVE.randomBytes(length), CURVE.n);
const length = (0, modular_js_1.getMinHashLength)(CURVE.n);
return (0, modular_js_1.mapHashToField)(CURVE.randomBytes(length), CURVE.n);
},

@@ -1156,3 +1156,3 @@ /**

function mapToCurveSimpleSWU(Fp, opts) {
mod.validateField(Fp);
(0, modular_js_1.validateField)(Fp);
if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))

@@ -1159,0 +1159,0 @@ throw new Error('mapToCurveSimpleSWU: invalid opts');

@@ -1,2 +0,2 @@

import { CurveFn } from './abstract/bls.js';
import { type CurveFn } from './abstract/bls.js';
/**

@@ -3,0 +3,0 @@ * bls12-381 pairing-friendly curve.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bls12_381 = void 0;
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
const sha256_1 = require("@noble/hashes/sha256");
const utils_1 = require("@noble/hashes/utils");
const bls_js_1 = require("./abstract/bls.js");
const mod = require("./abstract/modular.js");
const utils_js_1 = require("./abstract/utils.js");
// Types
const hash_to_curve_js_1 = require("./abstract/hash-to-curve.js");
const weierstrass_js_1 = require("./abstract/weierstrass.js");
const tower_js_1 = require("./abstract/tower.js");
/**

@@ -53,7 +43,2 @@ * bls12-381 is pairing-friendly Barreto-Lynn-Scott elliptic curve construction allowing to:

* To simplify calculations in Fp12, we construct extension tower:
* - Fp₁₂ = Fp₆² => Fp₂³
* - Fp(u) / (u² - β) where β = -1
* - Fp₂(v) / (v³ - ξ) where ξ = u + 1
* - Fp₆(w) / (w² - γ) where γ = v
* Here goes constants && point encoding format
*

@@ -69,2 +54,6 @@ * Embedding degree (k): 12

* ### Towers
* - Fp₁₂ = Fp₆² => Fp₂³
* - Fp(u) / (u² - β) where β = -1
* - Fp₂(v) / (v³ - ξ) where ξ = u + 1
* - Fp₆(w) / (w² - γ) where γ = v
* - Fp²[u] = Fp/u²+1

@@ -77,2 +66,12 @@ * - Fp⁶[v] = Fp²/v³-1-u

*/
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
const sha256_1 = require("@noble/hashes/sha256");
const utils_1 = require("@noble/hashes/utils");
const bls_js_1 = require("./abstract/bls.js");
const mod = require("./abstract/modular.js");
const utils_js_1 = require("./abstract/utils.js");
// Types
const hash_to_curve_js_1 = require("./abstract/hash-to-curve.js");
const tower_js_1 = require("./abstract/tower.js");
const weierstrass_js_1 = require("./abstract/weierstrass.js");
// Be friendly to bad ECMAScript parsers by not using bigint literals

@@ -79,0 +78,0 @@ // prettier-ignore

@@ -1,3 +0,3 @@

import { CurveFn } from './abstract/weierstrass.js';
import { CurveFn as BLSCurveFn, PostPrecomputeFn } from './abstract/bls.js';
import { type CurveFn as BLSCurveFn, type PostPrecomputeFn } from './abstract/bls.js';
import { type CurveFn } from './abstract/weierstrass.js';
export declare const _postPrecompute: PostPrecomputeFn;

@@ -4,0 +4,0 @@ /**

@@ -52,12 +52,11 @@ "use strict";

const sha256_1 = require("@noble/hashes/sha256");
const utils_1 = require("@noble/hashes/utils");
const _shortw_utils_js_1 = require("./_shortw_utils.js");
const weierstrass_js_1 = require("./abstract/weierstrass.js");
const utils_1 = require("@noble/hashes/utils");
const bls_js_1 = require("./abstract/bls.js");
const modular_js_1 = require("./abstract/modular.js");
const tower_js_1 = require("./abstract/tower.js");
const utils_js_1 = require("./abstract/utils.js");
const tower_js_1 = require("./abstract/tower.js");
const weierstrass_js_1 = require("./abstract/weierstrass.js");
// prettier-ignore
const _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);
// prettier-ignore
const _6n = BigInt(6);

@@ -64,0 +63,0 @@ const BN_X = BigInt('4965661367192848881');

@@ -1,6 +0,6 @@

import { AffinePoint, Group } from './abstract/curve.js';
import { CurveFn, ExtPointType } from './abstract/edwards.js';
import { htfBasicOpts, HTFMethod } from './abstract/hash-to-curve.js';
import { CurveFn as XCurveFn } from './abstract/montgomery.js';
import { Hex } from './abstract/utils.js';
import { type AffinePoint, type Group } from './abstract/curve.js';
import { type CurveFn, type ExtPointType } from './abstract/edwards.js';
import { type htfBasicOpts, type HTFMethod } from './abstract/hash-to-curve.js';
import { type CurveFn as XCurveFn } from './abstract/montgomery.js';
import { type Hex } from './abstract/utils.js';
export declare const ED25519_TORSION_SUBGROUP: string[];

@@ -7,0 +7,0 @@ /**

@@ -16,2 +16,3 @@ "use strict";

const utils_1 = require("@noble/hashes/utils");
const curve_js_1 = require("./abstract/curve.js");
const edwards_js_1 = require("./abstract/edwards.js");

@@ -21,3 +22,2 @@ const hash_to_curve_js_1 = require("./abstract/hash-to-curve.js");

const montgomery_js_1 = require("./abstract/montgomery.js");
const curve_js_1 = require("./abstract/curve.js");
const utils_js_1 = require("./abstract/utils.js");

@@ -24,0 +24,0 @@ const ED25519_P = BigInt('57896044618658097711785492504343953926634992332820282019728792003956564819949');

@@ -1,6 +0,6 @@

import { AffinePoint, Group } from './abstract/curve.js';
import { CurveFn, ExtPointType } from './abstract/edwards.js';
import { htfBasicOpts, HTFMethod } from './abstract/hash-to-curve.js';
import { CurveFn as XCurveFn } from './abstract/montgomery.js';
import { Hex } from './abstract/utils.js';
import type { AffinePoint, Group } from './abstract/curve.js';
import { type CurveFn, type ExtPointType } from './abstract/edwards.js';
import { type htfBasicOpts, type HTFMethod } from './abstract/hash-to-curve.js';
import { type CurveFn as XCurveFn } from './abstract/montgomery.js';
import { type Hex } from './abstract/utils.js';
/**

@@ -7,0 +7,0 @@ * ed448 EdDSA curve and methods.

@@ -16,2 +16,3 @@ "use strict";

const utils_1 = require("@noble/hashes/utils");
const curve_js_1 = require("./abstract/curve.js");
const edwards_js_1 = require("./abstract/edwards.js");

@@ -21,3 +22,2 @@ const hash_to_curve_js_1 = require("./abstract/hash-to-curve.js");

const montgomery_js_1 = require("./abstract/montgomery.js");
const curve_js_1 = require("./abstract/curve.js");
const utils_js_1 = require("./abstract/utils.js");

@@ -24,0 +24,0 @@ const shake256_114 = (0, utils_1.wrapConstructor)(() => sha3_1.shake256.create({ dkLen: 114 }));

import { randomBytes } from '@noble/hashes/utils';
import { CHash } from './abstract/utils.js';
import { CurveType, CurveFn } from './abstract/weierstrass.js';
import type { CHash } from './abstract/utils.js';
import { type CurveFn, type CurveType } from './abstract/weierstrass.js';
/** connects noble-curves to noble-hashes */

@@ -5,0 +5,0 @@ export declare function getHash(hash: CHash): {

@@ -19,7 +19,7 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { IField } from './modular.js';
import { Hex, PrivKey, CHash } from './utils.js';
import { MapToCurve, Opts as HTFOpts, htfBasicOpts, createHasher } from './hash-to-curve.js';
import { CurvePointsType, ProjPointType as ProjPointType, CurvePointsRes } from './weierstrass.js';
import type { Fp2, Fp6, Fp12, Fp2Bls, Fp12Bls } from './tower.js';
import { type IField } from './modular.js';
import { type CHash, type Hex, type PrivKey } from './utils.js';
import { type htfBasicOpts, type Opts as HTFOpts, type MapToCurve, createHasher } from './hash-to-curve.js';
import type { Fp12, Fp12Bls, Fp2, Fp2Bls, Fp6 } from './tower.js';
import { type CurvePointsRes, type CurvePointsType, type ProjPointType } from './weierstrass.js';
type Fp = bigint;

@@ -26,0 +26,0 @@ export type TwistType = 'multiplicative' | 'divisive';

@@ -7,3 +7,3 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { IField } from './modular.js';
import { type IField } from './modular.js';
export type AffinePoint<T> = {

@@ -10,0 +10,0 @@ x: T;

@@ -7,4 +7,4 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { validateField, nLength } from './modular.js';
import { validateObject, bitLen } from './utils.js';
import { nLength, validateField } from './modular.js';
import { bitLen, validateObject } from './utils.js';
const _0n = BigInt(0);

@@ -11,0 +11,0 @@ const _1n = BigInt(1);

@@ -7,4 +7,4 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { AffinePoint, BasicCurve, Group, GroupConstructor } from './curve.js';
import { FHash, Hex } from './utils.js';
import { type AffinePoint, type BasicCurve, type Group, type GroupConstructor } from './curve.js';
import { type FHash, type Hex } from './utils.js';
/** Edwards curves must declare params a & d. */

@@ -11,0 +11,0 @@ export type CurveType = BasicCurve<bigint> & {

@@ -7,6 +7,6 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { validateBasic, wNAF, pippenger, } from './curve.js';
import { mod, Field } from './modular.js';
import { pippenger, validateBasic, wNAF, } from './curve.js';
import { Field, mod } from './modular.js';
import * as ut from './utils.js';
import { ensureBytes, memoized, abool } from './utils.js';
import { abool, ensureBytes, memoized } from './utils.js';
// Be friendly to bad ECMAScript parsers by not using bigint literals

@@ -13,0 +13,0 @@ // prettier-ignore

@@ -8,3 +8,3 @@ /**

import type { AffinePoint, Group, GroupConstructor } from './curve.js';
import { IField } from './modular.js';
import { type IField } from './modular.js';
import type { CHash } from './utils.js';

@@ -11,0 +11,0 @@ export type UnicodeOrBytes = string | Uint8Array;

@@ -10,3 +10,3 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { IField } from './modular.js';
import { type IField } from './modular.js';
export type PoseidonOpts = {

@@ -13,0 +13,0 @@ Fp: IField<bigint>;

@@ -28,5 +28,5 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { AffinePoint, BasicCurve, Group, GroupConstructor } from './curve.js';
import * as mod from './modular.js';
import { CHash, Hex, PrivKey } from './utils.js';
import { type AffinePoint, type BasicCurve, type Group, type GroupConstructor } from './curve.js';
import { type IField } from './modular.js';
import { type CHash, type Hex, type PrivKey } from './utils.js';
export type { AffinePoint };

@@ -210,3 +210,3 @@ type HmacFnSync = (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;

*/
export declare function SWUFpSqrtRatio<T>(Fp: mod.IField<T>, Z: T): (u: T, v: T) => {
export declare function SWUFpSqrtRatio<T>(Fp: IField<T>, Z: T): (u: T, v: T) => {
isValid: boolean;

@@ -219,3 +219,3 @@ value: T;

*/
export declare function mapToCurveSimpleSWU<T>(Fp: mod.IField<T>, opts: {
export declare function mapToCurveSimpleSWU<T>(Fp: IField<T>, opts: {
A: T;

@@ -222,0 +222,0 @@ B: T;

@@ -28,6 +28,6 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { validateBasic, wNAF, pippenger, } from './curve.js';
import * as mod from './modular.js';
import { pippenger, validateBasic, wNAF, } from './curve.js';
import { Field, getMinHashLength, invert, mapHashToField, mod, validateField, } from './modular.js';
import * as ut from './utils.js';
import { ensureBytes, memoized, abool } from './utils.js';
import { abool, ensureBytes, memoized } from './utils.js';
function validateSigVerOpts(opts) {

@@ -190,3 +190,3 @@ if (opts.lowS !== undefined)

const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ
const Fn = mod.Field(CURVE.n, CURVE.nBitLength);
const Fn = Field(CURVE.n, CURVE.nBitLength);
const toBytes = CURVE.toBytes ||

@@ -249,3 +249,3 @@ ((_c, point, _isCompressed) => {

if (wrapPrivateKey)
num = mod.mod(num, N); // disabled by default, enabled for BLS
num = mod(num, N); // disabled by default, enabled for BLS
ut.aInRange('private key', num, _1n, N); // num in range [1..N-1]

@@ -657,6 +657,6 @@ return num;

function modN(a) {
return mod.mod(a, CURVE_ORDER);
return mod(a, CURVE_ORDER);
}
function invN(a) {
return mod.invert(a, CURVE_ORDER);
return invert(a, CURVE_ORDER);
}

@@ -810,4 +810,4 @@ const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({

randomPrivateKey: () => {
const length = mod.getMinHashLength(CURVE.n);
return mod.mapHashToField(CURVE.randomBytes(length), CURVE.n);
const length = getMinHashLength(CURVE.n);
return mapHashToField(CURVE.randomBytes(length), CURVE.n);
},

@@ -1148,3 +1148,3 @@ /**

export function mapToCurveSimpleSWU(Fp, opts) {
mod.validateField(Fp);
validateField(Fp);
if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))

@@ -1151,0 +1151,0 @@ throw new Error('mapToCurveSimpleSWU: invalid opts');

@@ -1,2 +0,2 @@

import { CurveFn } from './abstract/bls.js';
import { type CurveFn } from './abstract/bls.js';
/**

@@ -3,0 +3,0 @@ * bls12-381 pairing-friendly curve.

@@ -1,11 +0,1 @@

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { sha256 } from '@noble/hashes/sha256';
import { randomBytes } from '@noble/hashes/utils';
import { bls } from './abstract/bls.js';
import * as mod from './abstract/modular.js';
import { bitGet, bitLen, bytesToHex, bytesToNumberBE, concatBytes as concatB, ensureBytes, numberToBytesBE, } from './abstract/utils.js';
// Types
import { isogenyMap } from './abstract/hash-to-curve.js';
import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';
import { tower12, psiFrobenius } from './abstract/tower.js';
/**

@@ -50,7 +40,2 @@ * bls12-381 is pairing-friendly Barreto-Lynn-Scott elliptic curve construction allowing to:

* To simplify calculations in Fp12, we construct extension tower:
* - Fp₁₂ = Fp₆² => Fp₂³
* - Fp(u) / (u² - β) where β = -1
* - Fp₂(v) / (v³ - ξ) where ξ = u + 1
* - Fp₆(w) / (w² - γ) where γ = v
* Here goes constants && point encoding format
*

@@ -66,2 +51,6 @@ * Embedding degree (k): 12

* ### Towers
* - Fp₁₂ = Fp₆² => Fp₂³
* - Fp(u) / (u² - β) where β = -1
* - Fp₂(v) / (v³ - ξ) where ξ = u + 1
* - Fp₆(w) / (w² - γ) where γ = v
* - Fp²[u] = Fp/u²+1

@@ -74,2 +63,12 @@ * - Fp⁶[v] = Fp²/v³-1-u

*/
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { sha256 } from '@noble/hashes/sha256';
import { randomBytes } from '@noble/hashes/utils';
import { bls } from './abstract/bls.js';
import * as mod from './abstract/modular.js';
import { bitGet, bitLen, bytesToHex, bytesToNumberBE, concatBytes as concatB, ensureBytes, numberToBytesBE, } from './abstract/utils.js';
// Types
import { isogenyMap } from './abstract/hash-to-curve.js';
import { psiFrobenius, tower12 } from './abstract/tower.js';
import { mapToCurveSimpleSWU, } from './abstract/weierstrass.js';
// Be friendly to bad ECMAScript parsers by not using bigint literals

@@ -76,0 +75,0 @@ // prettier-ignore

@@ -1,3 +0,3 @@

import { CurveFn } from './abstract/weierstrass.js';
import { CurveFn as BLSCurveFn, PostPrecomputeFn } from './abstract/bls.js';
import { type CurveFn as BLSCurveFn, type PostPrecomputeFn } from './abstract/bls.js';
import { type CurveFn } from './abstract/weierstrass.js';
export declare const _postPrecompute: PostPrecomputeFn;

@@ -4,0 +4,0 @@ /**

@@ -49,12 +49,11 @@ /**

import { sha256 } from '@noble/hashes/sha256';
import { randomBytes } from '@noble/hashes/utils';
import { getHash } from './_shortw_utils.js';
import { weierstrass } from './abstract/weierstrass.js';
import { randomBytes } from '@noble/hashes/utils';
import { bls, } from './abstract/bls.js';
import { Field } from './abstract/modular.js';
import { psiFrobenius, tower12 } from './abstract/tower.js';
import { bitGet, bitLen, notImplemented } from './abstract/utils.js';
import { tower12, psiFrobenius } from './abstract/tower.js';
import { weierstrass } from './abstract/weierstrass.js';
// prettier-ignore
const _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);
// prettier-ignore
const _6n = BigInt(6);

@@ -61,0 +60,0 @@ const BN_X = BigInt('4965661367192848881');

@@ -1,6 +0,6 @@

import { AffinePoint, Group } from './abstract/curve.js';
import { CurveFn, ExtPointType } from './abstract/edwards.js';
import { htfBasicOpts, HTFMethod } from './abstract/hash-to-curve.js';
import { CurveFn as XCurveFn } from './abstract/montgomery.js';
import { Hex } from './abstract/utils.js';
import { type AffinePoint, type Group } from './abstract/curve.js';
import { type CurveFn, type ExtPointType } from './abstract/edwards.js';
import { type htfBasicOpts, type HTFMethod } from './abstract/hash-to-curve.js';
import { type CurveFn as XCurveFn } from './abstract/montgomery.js';
import { type Hex } from './abstract/utils.js';
export declare const ED25519_TORSION_SUBGROUP: string[];

@@ -7,0 +7,0 @@ /**

@@ -11,2 +11,3 @@ /**

import { concatBytes, randomBytes, utf8ToBytes } from '@noble/hashes/utils';
import { pippenger } from './abstract/curve.js';
import { twistedEdwards } from './abstract/edwards.js';

@@ -16,3 +17,2 @@ import { createHasher, expand_message_xmd, } from './abstract/hash-to-curve.js';

import { montgomery } from './abstract/montgomery.js';
import { pippenger } from './abstract/curve.js';
import { bytesToHex, bytesToNumberLE, ensureBytes, equalBytes, numberToBytesLE, } from './abstract/utils.js';

@@ -19,0 +19,0 @@ const ED25519_P = BigInt('57896044618658097711785492504343953926634992332820282019728792003956564819949');

@@ -1,6 +0,6 @@

import { AffinePoint, Group } from './abstract/curve.js';
import { CurveFn, ExtPointType } from './abstract/edwards.js';
import { htfBasicOpts, HTFMethod } from './abstract/hash-to-curve.js';
import { CurveFn as XCurveFn } from './abstract/montgomery.js';
import { Hex } from './abstract/utils.js';
import type { AffinePoint, Group } from './abstract/curve.js';
import { type CurveFn, type ExtPointType } from './abstract/edwards.js';
import { type htfBasicOpts, type HTFMethod } from './abstract/hash-to-curve.js';
import { type CurveFn as XCurveFn } from './abstract/montgomery.js';
import { type Hex } from './abstract/utils.js';
/**

@@ -7,0 +7,0 @@ * ed448 EdDSA curve and methods.

@@ -12,2 +12,3 @@ /**

import { concatBytes, randomBytes, utf8ToBytes, wrapConstructor } from '@noble/hashes/utils';
import { pippenger } from './abstract/curve.js';
import { twistedEdwards } from './abstract/edwards.js';

@@ -17,3 +18,2 @@ import { createHasher, expand_message_xof, } from './abstract/hash-to-curve.js';

import { montgomery } from './abstract/montgomery.js';
import { pippenger } from './abstract/curve.js';
import { bytesToHex, bytesToNumberLE, ensureBytes, equalBytes, numberToBytesLE, } from './abstract/utils.js';

@@ -20,0 +20,0 @@ const shake256_114 = wrapConstructor(() => shake256.create({ dkLen: 114 }));

/**
* Audited & minimal JS implementation of elliptic curve cryptography. Check out individual modules.
* Audited & minimal JS implementation of elliptic curve cryptography.
* @module
* @example
```js
import { secp256k1, schnorr } from '@noble/curves/secp256k1';
import { ed25519, ed25519ph, ed25519ctx, x25519, RistrettoPoint } from '@noble/curves/ed25519';
import { ed448, ed448ph, ed448ctx, x448 } from '@noble/curves/ed448';
import { p256 } from '@noble/curves/p256';
import { p384 } from '@noble/curves/p384';
import { p521 } from '@noble/curves/p521';
import { bls12_381 } from '@noble/curves/bls12-381';
import { bn254 } from '@noble/curves/bn254';
import { bytesToHex, hexToBytes, concatBytes, utf8ToBytes } from '@noble/curves/abstract/utils';
```
*/

@@ -5,0 +17,0 @@ throw new Error('root module cannot be imported: import submodules instead. Check out README');

@@ -1,2 +0,2 @@

import { CurveFn, ExtPointType } from './abstract/edwards.js';
import { type CurveFn, type ExtPointType } from './abstract/edwards.js';
export declare const jubjub: CurveFn;

@@ -3,0 +3,0 @@ export declare function groupHash(tag: Uint8Array, personalization: Uint8Array): ExtPointType;

@@ -1,3 +0,3 @@

import { CurveFnWithCreate } from './_shortw_utils.js';
import { HTFMethod } from './abstract/hash-to-curve.js';
import { type CurveFnWithCreate } from './_shortw_utils.js';
import { type HTFMethod } from './abstract/hash-to-curve.js';
/** secp256r1 curve, ECDSA and ECDH methods. */

@@ -4,0 +4,0 @@ export declare const p256: CurveFnWithCreate;

@@ -1,3 +0,3 @@

import { CurveFnWithCreate } from './_shortw_utils.js';
import { HTFMethod } from './abstract/hash-to-curve.js';
import { type CurveFnWithCreate } from './_shortw_utils.js';
import { type HTFMethod } from './abstract/hash-to-curve.js';
/** secp384r1 curve, ECDSA and ECDH methods. */

@@ -4,0 +4,0 @@ export declare const p384: CurveFnWithCreate;

@@ -1,3 +0,3 @@

import { CurveFnWithCreate } from './_shortw_utils.js';
import { HTFMethod } from './abstract/hash-to-curve.js';
import { type CurveFnWithCreate } from './_shortw_utils.js';
import { type HTFMethod } from './abstract/hash-to-curve.js';
/**

@@ -4,0 +4,0 @@ * NIST secp521r1 aka p521.

@@ -1,2 +0,2 @@

import { CurveFn } from './abstract/weierstrass.js';
import { type CurveFn } from './abstract/weierstrass.js';
export declare const p: bigint;

@@ -3,0 +3,0 @@ export declare const q: bigint;

@@ -1,7 +0,7 @@

import { CurveFnWithCreate } from './_shortw_utils.js';
import { HTFMethod } from './abstract/hash-to-curve.js';
import { type CurveFnWithCreate } from './_shortw_utils.js';
import { type HTFMethod } from './abstract/hash-to-curve.js';
import { mod } from './abstract/modular.js';
import type { Hex, PrivKey } from './abstract/utils.js';
import { bytesToNumberBE, numberToBytesBE } from './abstract/utils.js';
import { ProjPointType as PointType } from './abstract/weierstrass.js';
import { type ProjPointType as PointType } from './abstract/weierstrass.js';
/**

@@ -8,0 +8,0 @@ * secp256k1 short weierstrass curve and ECDSA signatures over it.

@@ -19,3 +19,3 @@ /**

import { Field, mod, pow2 } from './abstract/modular.js';
import { inRange, aInRange, bytesToNumberBE, concatBytes, ensureBytes, numberToBytesBE, } from './abstract/utils.js';
import { aInRange, bytesToNumberBE, concatBytes, ensureBytes, inRange, numberToBytesBE, } from './abstract/utils.js';
import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';

@@ -22,0 +22,0 @@ const secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f');

"use strict";
/**
* Audited & minimal JS implementation of elliptic curve cryptography. Check out individual modules.
* Audited & minimal JS implementation of elliptic curve cryptography.
* @module
* @example
```js
import { secp256k1, schnorr } from '@noble/curves/secp256k1';
import { ed25519, ed25519ph, ed25519ctx, x25519, RistrettoPoint } from '@noble/curves/ed25519';
import { ed448, ed448ph, ed448ctx, x448 } from '@noble/curves/ed448';
import { p256 } from '@noble/curves/p256';
import { p384 } from '@noble/curves/p384';
import { p521 } from '@noble/curves/p521';
import { bls12_381 } from '@noble/curves/bls12-381';
import { bn254 } from '@noble/curves/bn254';
import { bytesToHex, hexToBytes, concatBytes, utf8ToBytes } from '@noble/curves/abstract/utils';
```
*/
throw new Error('root module cannot be imported: import submodules instead. Check out README');
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import { CurveFn, ExtPointType } from './abstract/edwards.js';
import { type CurveFn, type ExtPointType } from './abstract/edwards.js';
export declare const jubjub: CurveFn;

@@ -3,0 +3,0 @@ export declare function groupHash(tag: Uint8Array, personalization: Uint8Array): ExtPointType;

@@ -1,3 +0,3 @@

import { CurveFnWithCreate } from './_shortw_utils.js';
import { HTFMethod } from './abstract/hash-to-curve.js';
import { type CurveFnWithCreate } from './_shortw_utils.js';
import { type HTFMethod } from './abstract/hash-to-curve.js';
/** secp256r1 curve, ECDSA and ECDH methods. */

@@ -4,0 +4,0 @@ export declare const p256: CurveFnWithCreate;

@@ -1,3 +0,3 @@

import { CurveFnWithCreate } from './_shortw_utils.js';
import { HTFMethod } from './abstract/hash-to-curve.js';
import { type CurveFnWithCreate } from './_shortw_utils.js';
import { type HTFMethod } from './abstract/hash-to-curve.js';
/** secp384r1 curve, ECDSA and ECDH methods. */

@@ -4,0 +4,0 @@ export declare const p384: CurveFnWithCreate;

@@ -1,3 +0,3 @@

import { CurveFnWithCreate } from './_shortw_utils.js';
import { HTFMethod } from './abstract/hash-to-curve.js';
import { type CurveFnWithCreate } from './_shortw_utils.js';
import { type HTFMethod } from './abstract/hash-to-curve.js';
/**

@@ -4,0 +4,0 @@ * NIST secp521r1 aka p521.

{
"name": "@noble/curves",
"version": "1.8.0",
"version": "1.8.1",
"description": "Audited & minimal JS implementation of elliptic curve cryptography",

@@ -17,4 +17,4 @@ "files": [

"bench:install": "cd benchmark; npm install; npm install .. --install-links",
"build": "tsc && tsc -p tsconfig.esm.json",
"build:release": "cd build && npm i && npm run build",
"build": "tsc && tsc -p tsconfig.cjs.json",
"build:release": "npx jsbt esbuild test/build",
"build:clean": "rm {.,esm,abstract,esm/abstract}/*.{js,d.ts,d.ts.map,js.map} 2> /dev/null",

@@ -24,3 +24,5 @@ "lint": "prettier --check 'src/**/*.{js,ts}' 'test/*.js'",

"test": "node test/index.js",
"test:coverage": "c8 node test/index.js"
"test:bun": "bun test/index.js",
"test:deno": "deno --allow-env --allow-read test/index.js",
"test:coverage": "npm install --no-save c8@10.1.2 && npx c8 npm test"
},

@@ -35,10 +37,9 @@ "author": "Paul Miller (https://paulmillr.com)",

"dependencies": {
"@noble/hashes": "1.7.0"
"@noble/hashes": "1.7.1"
},
"devDependencies": {
"@paulmillr/jsbt": "0.2.1",
"c8": "10.1.2",
"@paulmillr/jsbt": "0.3.1",
"fast-check": "3.0.0",
"micro-bmark": "0.3.1",
"micro-should": "0.4.0",
"micro-bmark": "0.4.0",
"micro-should": "0.5.1",
"prettier": "3.3.2",

@@ -45,0 +46,0 @@ "typescript": "5.5.2"

@@ -1,2 +0,2 @@

import { CurveFn } from './abstract/weierstrass.js';
import { type CurveFn } from './abstract/weierstrass.js';
export declare const p: bigint;

@@ -3,0 +3,0 @@ export declare const q: bigint;

@@ -39,6 +39,8 @@ # noble-curves

> npm install @noble/curves
> `npm install @noble/curves`
> deno add jsr:@noble/curves
> `deno add jsr:@noble/curves`
> `deno doc jsr:@noble/curves` # command-line documentation
We support all major platforms and runtimes.

@@ -64,4 +66,4 @@ For React Native, you may need a [polyfill for getRandomValues](https://github.com/LinusU/react-native-get-random-values).

- [Multi-scalar-multiplication](#multi-scalar-multiplication)
- [Accessing a curve's variables](#accessing-a-curves-variables)
- [All available imports](#all-available-imports)
- [Accessing a curve's variables](#accessing-a-curves-variables)
- [Abstract API](#abstract-api)

@@ -332,2 +334,14 @@ - [weierstrass: Short Weierstrass curve](#weierstrass-short-weierstrass-curve)

#### Accessing a curve's variables
```ts
import { secp256k1 } from '@noble/curves/secp256k1';
// Every curve has `CURVE` object that contains its parameters, field, and others
console.log(secp256k1.CURVE.p); // field modulus
console.log(secp256k1.CURVE.n); // curve order
console.log(secp256k1.CURVE.a, secp256k1.CURVE.b); // equation params
console.log(secp256k1.CURVE.Gx, secp256k1.CURVE.Gy); // base point coordinates
```
#### All available imports

@@ -349,13 +363,2 @@

#### Accessing a curve's variables
```ts
import { secp256k1 } from '@noble/curves/secp256k1';
// Every curve has `CURVE` object that contains its parameters, field, and others
console.log(secp256k1.CURVE.p); // field modulus
console.log(secp256k1.CURVE.n); // curve order
console.log(secp256k1.CURVE.a, secp256k1.CURVE.b); // equation params
console.log(secp256k1.CURVE.Gx, secp256k1.CURVE.Gy); // base point coordinates
```
## Abstract API

@@ -362,0 +365,0 @@

@@ -1,7 +0,7 @@

import { CurveFnWithCreate } from './_shortw_utils.js';
import { HTFMethod } from './abstract/hash-to-curve.js';
import { type CurveFnWithCreate } from './_shortw_utils.js';
import { type HTFMethod } from './abstract/hash-to-curve.js';
import { mod } from './abstract/modular.js';
import type { Hex, PrivKey } from './abstract/utils.js';
import { bytesToNumberBE, numberToBytesBE } from './abstract/utils.js';
import { ProjPointType as PointType } from './abstract/weierstrass.js';
import { type ProjPointType as PointType } from './abstract/weierstrass.js';
/**

@@ -8,0 +8,0 @@ * secp256k1 short weierstrass curve and ECDSA signatures over it.

@@ -8,4 +8,4 @@ /**

import { concatBytes, randomBytes } from '@noble/hashes/utils';
import { CHash } from './abstract/utils.js';
import { CurveType, CurveFn, weierstrass } from './abstract/weierstrass.js';
import type { CHash } from './abstract/utils.js';
import { type CurveFn, type CurveType, weierstrass } from './abstract/weierstrass.js';

@@ -12,0 +12,0 @@ /** connects noble-curves to noble-hashes */

@@ -20,16 +20,18 @@ /**

// TODO: import { AffinePoint } from './curve.js';
import { IField, getMinHashLength, mapHashToField } from './modular.js';
import { Hex, PrivKey, CHash, ensureBytes, memoized } from './utils.js';
import { type IField, getMinHashLength, mapHashToField } from './modular.js';
import { type CHash, type Hex, type PrivKey, ensureBytes, memoized } from './utils.js';
// prettier-ignore
import {
MapToCurve, Opts as HTFOpts, H2CPointConstructor, htfBasicOpts,
type H2CPointConstructor, type htfBasicOpts,
type Opts as HTFOpts,
type MapToCurve,
createHasher
} from './hash-to-curve.js';
import type { Fp12, Fp12Bls, Fp2, Fp2Bls, Fp6 } from './tower.js';
import {
CurvePointsType,
ProjPointType as ProjPointType,
CurvePointsRes,
type CurvePointsRes,
type CurvePointsType,
type ProjPointType,
weierstrassPoints,
} from './weierstrass.js';
import type { Fp2, Fp6, Fp12, Fp2Bls, Fp12Bls } from './tower.js';

@@ -36,0 +38,0 @@ type Fp = bigint; // Can be different field?

@@ -7,4 +7,4 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { IField, validateField, nLength } from './modular.js';
import { validateObject, bitLen } from './utils.js';
import { type IField, nLength, validateField } from './modular.js';
import { bitLen, validateObject } from './utils.js';

@@ -11,0 +11,0 @@ const _0n = BigInt(0);

@@ -8,13 +8,13 @@ /**

import {
AffinePoint,
BasicCurve,
Group,
GroupConstructor,
type AffinePoint,
type BasicCurve,
type Group,
type GroupConstructor,
pippenger,
validateBasic,
wNAF,
pippenger,
} from './curve.js';
import { mod, Field } from './modular.js';
import { Field, mod } from './modular.js';
import * as ut from './utils.js';
import { ensureBytes, FHash, Hex, memoized, abool } from './utils.js';
import { abool, ensureBytes, type FHash, type Hex, memoized } from './utils.js';

@@ -21,0 +21,0 @@ // Be friendly to bad ECMAScript parsers by not using bigint literals

@@ -8,3 +8,3 @@ /**

import type { AffinePoint, Group, GroupConstructor } from './curve.js';
import { IField, mod } from './modular.js';
import { type IField, mod } from './modular.js';
import type { CHash } from './utils.js';

@@ -11,0 +11,0 @@ import { abytes, bytesToNumberBE, concatBytes, utf8ToBytes, validateObject } from './utils.js';

@@ -10,3 +10,3 @@ /**

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { FpPow, IField, validateField } from './modular.js';
import { FpPow, type IField, validateField } from './modular.js';

@@ -13,0 +13,0 @@ export type PoseidonOpts = {

@@ -29,13 +29,21 @@ /**

import {
AffinePoint,
BasicCurve,
Group,
GroupConstructor,
type AffinePoint,
type BasicCurve,
type Group,
type GroupConstructor,
pippenger,
validateBasic,
wNAF,
pippenger,
} from './curve.js';
import * as mod from './modular.js';
import {
Field,
type IField,
getMinHashLength,
invert,
mapHashToField,
mod,
validateField,
} from './modular.js';
import * as ut from './utils.js';
import { CHash, Hex, PrivKey, ensureBytes, memoized, abool } from './utils.js';
import { type CHash, type Hex, type PrivKey, abool, ensureBytes, memoized } from './utils.js';

@@ -283,3 +291,3 @@ export type { AffinePoint };

const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ
const Fn = mod.Field(CURVE.n, CURVE.nBitLength);
const Fn = Field(CURVE.n, CURVE.nBitLength);

@@ -346,3 +354,3 @@ const toBytes =

}
if (wrapPrivateKey) num = mod.mod(num, N); // disabled by default, enabled for BLS
if (wrapPrivateKey) num = mod(num, N); // disabled by default, enabled for BLS
ut.aInRange('private key', num, _1n, N); // num in range [1..N-1]

@@ -821,6 +829,6 @@ return num;

function modN(a: bigint) {
return mod.mod(a, CURVE_ORDER);
return mod(a, CURVE_ORDER);
}
function invN(a: bigint) {
return mod.invert(a, CURVE_ORDER);
return invert(a, CURVE_ORDER);
}

@@ -989,4 +997,4 @@

randomPrivateKey: (): Uint8Array => {
const length = mod.getMinHashLength(CURVE.n);
return mod.mapHashToField(CURVE.randomBytes(length), CURVE.n);
const length = getMinHashLength(CURVE.n);
return mapHashToField(CURVE.randomBytes(length), CURVE.n);
},

@@ -1253,3 +1261,3 @@

export function SWUFpSqrtRatio<T>(
Fp: mod.IField<T>,
Fp: IField<T>,
Z: T

@@ -1329,3 +1337,3 @@ ): (u: T, v: T) => { isValid: boolean; value: T } {

export function mapToCurveSimpleSWU<T>(
Fp: mod.IField<T>,
Fp: IField<T>,
opts: {

@@ -1337,3 +1345,3 @@ A: T;

): (u: T) => { x: T; y: T } {
mod.validateField(Fp);
validateField(Fp);
if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))

@@ -1340,0 +1348,0 @@ throw new Error('mapToCurveSimpleSWU: invalid opts');

@@ -1,22 +0,1 @@

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { sha256 } from '@noble/hashes/sha256';
import { randomBytes } from '@noble/hashes/utils';
import { bls, CurveFn } from './abstract/bls.js';
import * as mod from './abstract/modular.js';
import {
bitGet,
bitLen,
bytesToHex,
bytesToNumberBE,
concatBytes as concatB,
ensureBytes,
Hex,
numberToBytesBE,
} from './abstract/utils.js';
// Types
import { isogenyMap } from './abstract/hash-to-curve.js';
import { AffinePoint, mapToCurveSimpleSWU, ProjPointType } from './abstract/weierstrass.js';
import { tower12, psiFrobenius } from './abstract/tower.js';
import type { Fp, Fp2, Fp6, Fp12 } from './abstract/tower.js';
/**

@@ -61,7 +40,2 @@ * bls12-381 is pairing-friendly Barreto-Lynn-Scott elliptic curve construction allowing to:

* To simplify calculations in Fp12, we construct extension tower:
* - Fp₁₂ = Fp₆² => Fp₂³
* - Fp(u) / (u² - β) where β = -1
* - Fp₂(v) / (v³ - ξ) where ξ = u + 1
* - Fp₆(w) / (w² - γ) where γ = v
* Here goes constants && point encoding format
*

@@ -77,2 +51,6 @@ * Embedding degree (k): 12

* ### Towers
* - Fp₁₂ = Fp₆² => Fp₂³
* - Fp(u) / (u² - β) where β = -1
* - Fp₂(v) / (v³ - ξ) where ξ = u + 1
* - Fp₆(w) / (w² - γ) where γ = v
* - Fp²[u] = Fp/u²+1

@@ -85,2 +63,26 @@ * - Fp⁶[v] = Fp²/v³-1-u

*/
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
import { sha256 } from '@noble/hashes/sha256';
import { randomBytes } from '@noble/hashes/utils';
import { bls, type CurveFn } from './abstract/bls.js';
import * as mod from './abstract/modular.js';
import {
bitGet,
bitLen,
bytesToHex,
bytesToNumberBE,
concatBytes as concatB,
ensureBytes,
type Hex,
numberToBytesBE,
} from './abstract/utils.js';
// Types
import { isogenyMap } from './abstract/hash-to-curve.js';
import type { Fp, Fp12, Fp2, Fp6 } from './abstract/tower.js';
import { psiFrobenius, tower12 } from './abstract/tower.js';
import {
type AffinePoint,
mapToCurveSimpleSWU,
type ProjPointType,
} from './abstract/weierstrass.js';

@@ -87,0 +89,0 @@ // Be friendly to bad ECMAScript parsers by not using bigint literals

@@ -49,19 +49,17 @@ /**

import { sha256 } from '@noble/hashes/sha256';
import { randomBytes } from '@noble/hashes/utils';
import { getHash } from './_shortw_utils.js';
import { CurveFn, weierstrass } from './abstract/weierstrass.js';
import { randomBytes } from '@noble/hashes/utils';
import {
bls,
CurveFn as BLSCurveFn,
PostPrecomputeFn,
PostPrecomputePointAddFn,
type CurveFn as BLSCurveFn,
type PostPrecomputeFn,
type PostPrecomputePointAddFn,
} from './abstract/bls.js';
import { Field } from './abstract/modular.js';
import type { Fp, Fp12, Fp2, Fp6 } from './abstract/tower.js';
import { psiFrobenius, tower12 } from './abstract/tower.js';
import { bitGet, bitLen, notImplemented } from './abstract/utils.js';
import { tower12, psiFrobenius } from './abstract/tower.js';
// Types
import type { Fp, Fp2, Fp6, Fp12 } from './abstract/tower.js';
import { type CurveFn, weierstrass } from './abstract/weierstrass.js';
// prettier-ignore
const _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);
// prettier-ignore
const _6n = BigInt(6);

@@ -68,0 +66,0 @@

@@ -11,13 +11,12 @@ /**

import { concatBytes, randomBytes, utf8ToBytes } from '@noble/hashes/utils';
import { AffinePoint, Group } from './abstract/curve.js';
import { CurveFn, ExtPointType, twistedEdwards } from './abstract/edwards.js';
import { type AffinePoint, type Group, pippenger } from './abstract/curve.js';
import { type CurveFn, type ExtPointType, twistedEdwards } from './abstract/edwards.js';
import {
createHasher,
expand_message_xmd,
htfBasicOpts,
HTFMethod,
type htfBasicOpts,
type HTFMethod,
} from './abstract/hash-to-curve.js';
import { Field, FpSqrtEven, isNegativeLE, mod, pow2 } from './abstract/modular.js';
import { CurveFn as XCurveFn, montgomery } from './abstract/montgomery.js';
import { pippenger } from './abstract/curve.js';
import { montgomery, type CurveFn as XCurveFn } from './abstract/montgomery.js';
import {

@@ -28,3 +27,3 @@ bytesToHex,

equalBytes,
Hex,
type Hex,
numberToBytesLE,

@@ -31,0 +30,0 @@ } from './abstract/utils.js';

@@ -12,13 +12,13 @@ /**

import { concatBytes, randomBytes, utf8ToBytes, wrapConstructor } from '@noble/hashes/utils';
import { AffinePoint, Group } from './abstract/curve.js';
import { CurveFn, ExtPointType, twistedEdwards } from './abstract/edwards.js';
import type { AffinePoint, Group } from './abstract/curve.js';
import { pippenger } from './abstract/curve.js';
import { type CurveFn, type ExtPointType, twistedEdwards } from './abstract/edwards.js';
import {
createHasher,
expand_message_xof,
htfBasicOpts,
HTFMethod,
type htfBasicOpts,
type HTFMethod,
} from './abstract/hash-to-curve.js';
import { Field, isNegativeLE, mod, pow2 } from './abstract/modular.js';
import { CurveFn as XCurveFn, montgomery } from './abstract/montgomery.js';
import { pippenger } from './abstract/curve.js';
import { montgomery, type CurveFn as XCurveFn } from './abstract/montgomery.js';
import {

@@ -29,3 +29,3 @@ bytesToHex,

equalBytes,
Hex,
type Hex,
numberToBytesLE,

@@ -32,0 +32,0 @@ } from './abstract/utils.js';

/**
* Audited & minimal JS implementation of elliptic curve cryptography. Check out individual modules.
* Audited & minimal JS implementation of elliptic curve cryptography.
* @module
* @example
```js
import { secp256k1, schnorr } from '@noble/curves/secp256k1';
import { ed25519, ed25519ph, ed25519ctx, x25519, RistrettoPoint } from '@noble/curves/ed25519';
import { ed448, ed448ph, ed448ctx, x448 } from '@noble/curves/ed448';
import { p256 } from '@noble/curves/p256';
import { p384 } from '@noble/curves/p384';
import { p521 } from '@noble/curves/p521';
import { bls12_381 } from '@noble/curves/bls12-381';
import { bn254 } from '@noble/curves/bn254';
import { bytesToHex, hexToBytes, concatBytes, utf8ToBytes } from '@noble/curves/abstract/utils';
```
*/
throw new Error('root module cannot be imported: import submodules instead. Check out README');

@@ -11,3 +11,3 @@ /**

import { concatBytes, randomBytes, utf8ToBytes } from '@noble/hashes/utils';
import { CurveFn, ExtPointType, twistedEdwards } from './abstract/edwards.js';
import { type CurveFn, type ExtPointType, twistedEdwards } from './abstract/edwards.js';
import { Field } from './abstract/modular.js';

@@ -14,0 +14,0 @@

@@ -8,4 +8,4 @@ /**

import { sha256 } from '@noble/hashes/sha256';
import { createCurve, CurveFnWithCreate } from './_shortw_utils.js';
import { createHasher, HTFMethod } from './abstract/hash-to-curve.js';
import { createCurve, type CurveFnWithCreate } from './_shortw_utils.js';
import { createHasher, type HTFMethod } from './abstract/hash-to-curve.js';
import { Field } from './abstract/modular.js';

@@ -12,0 +12,0 @@ import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';

@@ -8,4 +8,4 @@ /**

import { sha384 } from '@noble/hashes/sha512';
import { createCurve, CurveFnWithCreate } from './_shortw_utils.js';
import { createHasher, HTFMethod } from './abstract/hash-to-curve.js';
import { createCurve, type CurveFnWithCreate } from './_shortw_utils.js';
import { createHasher, type HTFMethod } from './abstract/hash-to-curve.js';
import { Field } from './abstract/modular.js';

@@ -12,0 +12,0 @@ import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';

@@ -9,4 +9,4 @@ /**

import { sha512 } from '@noble/hashes/sha512';
import { createCurve, CurveFnWithCreate } from './_shortw_utils.js';
import { createHasher, HTFMethod } from './abstract/hash-to-curve.js';
import { createCurve, type CurveFnWithCreate } from './_shortw_utils.js';
import { createHasher, type HTFMethod } from './abstract/hash-to-curve.js';
import { Field } from './abstract/modular.js';

@@ -13,0 +13,0 @@ import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';

@@ -9,3 +9,3 @@ /**

import { Field, mod } from './abstract/modular.js';
import { CurveFn, weierstrass } from './abstract/weierstrass.js';
import { type CurveFn, weierstrass } from './abstract/weierstrass.js';

@@ -12,0 +12,0 @@ export const p: bigint = BigInt(

@@ -16,8 +16,7 @@ /**

import { randomBytes } from '@noble/hashes/utils';
import { createCurve, CurveFnWithCreate } from './_shortw_utils.js';
import { createHasher, HTFMethod, isogenyMap } from './abstract/hash-to-curve.js';
import { createCurve, type CurveFnWithCreate } from './_shortw_utils.js';
import { createHasher, type HTFMethod, isogenyMap } from './abstract/hash-to-curve.js';
import { Field, mod, pow2 } from './abstract/modular.js';
import type { Hex, PrivKey } from './abstract/utils.js';
import {
inRange,
aInRange,

@@ -27,5 +26,6 @@ bytesToNumberBE,

ensureBytes,
inRange,
numberToBytesBE,
} from './abstract/utils.js';
import { ProjPointType as PointType, mapToCurveSimpleSWU } from './abstract/weierstrass.js';
import { mapToCurveSimpleSWU, type ProjPointType as PointType } from './abstract/weierstrass.js';

@@ -32,0 +32,0 @@ const secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f');

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

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

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

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

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

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

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