Skip to main content
Version: Next

Namespace: weierstrass

ec.weierstrass

Interfaces​

Type Aliases​

AffinePoint​

Ƭ AffinePoint<T>: { x: T ; y: T } & { z?: never ; t?: never }

Type parameters​

Name
T

Defined in​

node_modules/@noble/curves/esm/abstract/curve.d.ts:3


BasicWCurve​

Ƭ BasicWCurve<T>: BasicCurve<T> & { a: T ; b: T ; allowedPrivateKeyLengths?: readonly number[] ; wrapPrivateKey?: boolean ; endo?: EndomorphismOpts ; isTorsionFree?: (c: ProjConstructor<T>, point: ProjPointType<T>) => boolean ; clearCofactor?: (c: ProjConstructor<T>, point: ProjPointType<T>) => ProjPointType<T> }

Type parameters​

Name
T

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:16


SignOpts​

Ƭ SignOpts: Object

Type declaration​

NameType
lowS?boolean
extraEntropy?Entropy
prehash?boolean

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:26


VerOpts​

Ƭ VerOpts: Object

Type declaration​

NameType
lowS?boolean
prehash?boolean
format?"compact" | "der"

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:31


CurvePointsType​

Ƭ CurvePointsType<T>: BasicWCurve<T> & { fromBytes?: (bytes: Uint8Array) => AffinePoint<T> ; toBytes?: (c: ProjConstructor<T>, point: ProjPointType<T>, isCompressed: boolean) => Uint8Array }

Type parameters​

Name
T

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:83


CurvePointsRes​

Ƭ CurvePointsRes<T>: Object

Type parameters​

Name
T

Type declaration​

NameType
CURVEReturnType<typeof validatePointOpts>
ProjectivePointProjConstructor<T>
normPrivateKeyToScalar(key: PrivKey) => bigint
weierstrassEquation(x: T) => T
isWithinCurveOrder(num: bigint) => boolean

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:108


RecoveredSignatureType​

Ƭ RecoveredSignatureType: SignatureType & { recovery: number }

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:165


SignatureConstructor​

Ƭ SignatureConstructor: Object

Call signature​

• new SignatureConstructor(r, s): SignatureType

Parameters​
NameType
rbigint
sbigint
Returns​

SignatureType

Type declaration​

NameType
fromCompact(hex: Hex) => SignatureType
fromDER(hex: Hex) => SignatureType

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:168


PubKey​

Ƭ PubKey: Hex | ProjPointType<bigint>

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:177


CurveType​

Ƭ CurveType: BasicWCurve<bigint> & { hash: CHash ; hmac: HmacFnSync ; randomBytes: (bytesLength?: number) => Uint8Array ; lowS?: boolean ; bits2int?: (bytes: Uint8Array) => bigint ; bits2int_modN?: (bytes: Uint8Array) => bigint }

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:178


CurveFn​

Ƭ CurveFn: Object

Type declaration​

NameType
CURVEReturnType<typeof validateOpts>
getPublicKey(privateKey: PrivKey, isCompressed?: boolean) => Uint8Array
getSharedSecret(privateA: PrivKey, publicB: Hex, isCompressed?: boolean) => Uint8Array
sign(msgHash: Hex, privKey: PrivKey, opts?: SignOpts) => RecoveredSignatureType
verify(signature: Hex | SignatureLike, msgHash: Hex, publicKey: Hex, opts?: VerOpts) => boolean
ProjectivePointProjConstructor<bigint>
SignatureSignatureConstructor
utils{ normPrivateKeyToScalar: (key: PrivKey) => bigint ; randomPrivateKey: () => Uint8Array ; precompute: (windowSize?: number, point?: ProjPointType<bigint>) => ProjPointType<bigint> ; isValidPrivateKey: (privateKey: PrivKey) => boolean }
utils.normPrivateKeyToScalar(key: PrivKey) => bigint
utils.randomPrivateKey() => Uint8Array
utils.precompute(windowSize?: number, point?: ProjPointType<bigint>) => ProjPointType<bigint>
utils.isValidPrivateKey[object Object]

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:211

Variables​

DER​

• Const DER: Object

ASN.1 DER encoding utilities. ASN is very complex & fragile. Format:

[0x30 (SEQUENCE), bytelength, 0x02 (INTEGER), intLength, R, 0x02 (INTEGER), intLength, S]

Docs: https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/, https://luca.ntop.org/Teaching/Appunti/asn1.html

Type declaration​

NameType
Err(m?: string) => { name: string ; message: string ; stack?: string }
_tlv{ encode: (tag: number, data: string) => string ; decode: (tag: number, data: Uint8Array) => { v: Uint8Array ; l: Uint8Array } }
_tlv.encode(tag: number, data: string) => string
_tlv.decode[object Object]
_int{ encode: (num: bigint) => string ; decode: (data: Uint8Array) => bigint }
_int.encode[object Object]
_int.decode[object Object]
toSig(hex: string | Uint8Array) => { r: bigint ; s: bigint }
hexFromSig(sig: { r: bigint ; s: bigint }) => string

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:122

Functions​

weierstrassPoints​

â–¸ weierstrassPoints<T>(opts): CurvePointsRes<T>

Type parameters​

Name
T

Parameters​

NameType
optsCurvePointsType<T>

Returns​

CurvePointsRes<T>

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:150


weierstrass​

â–¸ weierstrass(curveDef): CurveFn

Creates short weierstrass curve and ECDSA signature methods for it.

Parameters​

NameType
curveDefCurveType

Returns​

CurveFn

Example

import { Field } from '@noble/curves/abstract/modular';
// Before that, define BigInt-s: a, b, p, n, Gx, Gy
const curve = weierstrass({ a, b, Fp: Field(p), n, Gx, Gy, h: 1n })

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:233


SWUFpSqrtRatio​

â–¸ SWUFpSqrtRatio<T>(Fp, Z): (u: T, v: T) => { isValid: boolean ; value: T }

Implementation of the Shallue and van de Woestijne method for any weierstrass curve. TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular. b = True and y = sqrt(u / v) if (u / v) is square in F, and b = False and y = sqrt(Z * (u / v)) otherwise.

Type parameters​

Name
T

Parameters​

NameType
FpIField<T>
ZT

Returns​

fn

â–¸ (u, v): Object

Parameters​
NameType
uT
vT
Returns​

Object

NameType
isValidboolean
valueT

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:243


mapToCurveSimpleSWU​

â–¸ mapToCurveSimpleSWU<T>(Fp, opts): (u: T) => { x: T ; y: T }

Simplified Shallue-van de Woestijne-Ulas Method https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2

Type parameters​

Name
T

Parameters​

NameType
FpIField<T>
optsObject
opts.AT
opts.BT
opts.ZT

Returns​

fn

â–¸ (u): Object

Parameters​
NameType
uT
Returns​

Object

NameType
xT
yT

Defined in​

node_modules/@noble/curves/esm/abstract/weierstrass.d.ts:251