@noble/curves 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -23
- package/_shortw_utils.d.ts +16 -16
- package/_shortw_utils.d.ts.map +1 -1
- package/_shortw_utils.js +2 -3
- package/_shortw_utils.js.map +1 -1
- package/abstract/bls.d.ts +24 -22
- package/abstract/bls.d.ts.map +1 -1
- package/abstract/bls.js +1 -2
- package/abstract/bls.js.map +1 -1
- package/abstract/curve.d.ts.map +1 -1
- package/abstract/curve.js +2 -3
- package/abstract/curve.js.map +1 -1
- package/abstract/edwards.d.ts +12 -12
- package/abstract/edwards.d.ts.map +1 -1
- package/abstract/edwards.js +2 -3
- package/abstract/edwards.js.map +1 -1
- package/abstract/hash-to-curve.d.ts +2 -1
- package/abstract/hash-to-curve.d.ts.map +1 -1
- package/abstract/hash-to-curve.js +16 -6
- package/abstract/hash-to-curve.js.map +1 -1
- package/abstract/modular.d.ts.map +1 -1
- package/abstract/modular.js +20 -20
- package/abstract/modular.js.map +1 -1
- package/abstract/montgomery.js +1 -2
- package/abstract/montgomery.js.map +1 -1
- package/abstract/poseidon.d.ts +2 -2
- package/abstract/poseidon.d.ts.map +1 -1
- package/abstract/poseidon.js +3 -4
- package/abstract/poseidon.js.map +1 -1
- package/abstract/utils.d.ts +5 -5
- package/abstract/utils.js +24 -24
- package/abstract/utils.js.map +1 -1
- package/abstract/weierstrass.d.ts +16 -17
- package/abstract/weierstrass.d.ts.map +1 -1
- package/abstract/weierstrass.js +6 -6
- package/abstract/weierstrass.js.map +1 -1
- package/bls12-381.d.ts +0 -1
- package/bls12-381.d.ts.map +1 -1
- package/bls12-381.js +34 -32
- package/bls12-381.js.map +1 -1
- package/bn254.js +1 -1
- package/bn254.js.map +1 -1
- package/ed25519.d.ts +4 -4
- package/ed25519.d.ts.map +1 -1
- package/ed25519.js +31 -30
- package/ed25519.js.map +1 -1
- package/ed448.d.ts +3 -3
- package/ed448.d.ts.map +1 -1
- package/ed448.js +3 -3
- package/ed448.js.map +1 -1
- package/esm/_shortw_utils.d.ts +62 -0
- package/esm/_shortw_utils.d.ts.map +1 -0
- package/esm/_shortw_utils.js.map +1 -1
- package/esm/abstract/bls.d.ts +122 -0
- package/esm/abstract/bls.d.ts.map +1 -0
- package/esm/abstract/bls.js.map +1 -1
- package/esm/abstract/curve.d.ts +70 -0
- package/esm/abstract/curve.d.ts.map +1 -0
- package/esm/abstract/edwards.d.ts +89 -0
- package/esm/abstract/edwards.d.ts.map +1 -0
- package/esm/abstract/edwards.js +1 -1
- package/esm/abstract/edwards.js.map +1 -1
- package/esm/abstract/hash-to-curve.d.ts +58 -0
- package/esm/abstract/hash-to-curve.d.ts.map +1 -0
- package/esm/abstract/hash-to-curve.js +12 -1
- package/esm/abstract/hash-to-curve.js.map +1 -1
- package/esm/abstract/modular.d.ts +123 -0
- package/esm/abstract/modular.d.ts.map +1 -0
- package/esm/abstract/modular.js +1 -1
- package/esm/abstract/modular.js.map +1 -1
- package/esm/abstract/montgomery.d.ts +26 -0
- package/esm/abstract/montgomery.d.ts.map +1 -0
- package/esm/abstract/poseidon.d.ts +30 -0
- package/esm/abstract/poseidon.d.ts.map +1 -0
- package/esm/abstract/poseidon.js.map +1 -1
- package/esm/abstract/utils.d.ts +94 -0
- package/esm/abstract/utils.d.ts.map +1 -0
- package/esm/abstract/utils.js +3 -3
- package/esm/abstract/utils.js.map +1 -1
- package/esm/abstract/weierstrass.d.ts +236 -0
- package/esm/abstract/weierstrass.d.ts.map +1 -0
- package/esm/abstract/weierstrass.js +1 -1
- package/esm/abstract/weierstrass.js.map +1 -1
- package/esm/bls12-381.d.ts +67 -0
- package/esm/bls12-381.d.ts.map +1 -0
- package/esm/bls12-381.js +34 -32
- package/esm/bls12-381.js.map +1 -1
- package/esm/bn254.d.ts +9 -0
- package/esm/bn254.d.ts.map +1 -0
- package/esm/bn254.js +1 -1
- package/esm/bn254.js.map +1 -1
- package/esm/ed25519.d.ts +78 -0
- package/esm/ed25519.d.ts.map +1 -0
- package/esm/ed25519.js +28 -27
- package/esm/ed25519.js.map +1 -1
- package/esm/ed448.d.ts +67 -0
- package/esm/ed448.d.ts.map +1 -0
- package/esm/ed448.js +2 -2
- package/esm/ed448.js.map +1 -1
- package/esm/index.d.ts +2 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/jubjub.d.ts +9 -0
- package/esm/jubjub.d.ts.map +1 -0
- package/esm/jubjub.js +1 -1
- package/esm/jubjub.js.map +1 -1
- package/esm/p256.d.ts +105 -0
- package/esm/p256.d.ts.map +1 -0
- package/esm/p256.js +2 -2
- package/esm/p256.js.map +1 -1
- package/esm/p384.d.ts +105 -0
- package/esm/p384.d.ts.map +1 -0
- package/esm/p384.js +2 -2
- package/esm/p384.js.map +1 -1
- package/esm/p521.d.ts +105 -0
- package/esm/p521.d.ts.map +1 -0
- package/esm/p521.js +2 -2
- package/esm/p521.js.map +1 -1
- package/esm/pasta.d.ts +5 -0
- package/esm/pasta.d.ts.map +1 -0
- package/esm/pasta.js +6 -6
- package/esm/pasta.js.map +1 -1
- package/esm/secp256k1.d.ts +93 -0
- package/esm/secp256k1.d.ts.map +1 -0
- package/esm/secp256k1.js +3 -3
- package/esm/secp256k1.js.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/jubjub.js +4 -4
- package/jubjub.js.map +1 -1
- package/p256.d.ts +32 -32
- package/p256.d.ts.map +1 -1
- package/p256.js +2 -2
- package/p256.js.map +1 -1
- package/p384.d.ts +32 -32
- package/p384.d.ts.map +1 -1
- package/p384.js +2 -2
- package/p384.js.map +1 -1
- package/p521.d.ts +32 -32
- package/p521.d.ts.map +1 -1
- package/p521.js +2 -2
- package/p521.js.map +1 -1
- package/package.json +31 -53
- package/pasta.js +6 -6
- package/pasta.js.map +1 -1
- package/secp256k1.d.ts +18 -18
- package/secp256k1.d.ts.map +1 -1
- package/secp256k1.js +3 -3
- package/secp256k1.js.map +1 -1
- package/src/_shortw_utils.ts +1 -1
- package/src/abstract/bls.ts +31 -25
- package/src/abstract/edwards.ts +3 -2
- package/src/abstract/hash-to-curve.ts +13 -3
- package/src/abstract/modular.ts +2 -2
- package/src/abstract/poseidon.ts +1 -1
- package/src/abstract/utils.ts +3 -3
- package/src/abstract/weierstrass.ts +1 -1
- package/src/bls12-381.ts +46 -44
- package/src/bn254.ts +1 -1
- package/src/ed25519.ts +76 -68
- package/src/ed448.ts +3 -3
- package/src/index.ts +1 -1
- package/src/jubjub.ts +1 -1
- package/src/p256.ts +2 -2
- package/src/p384.ts +2 -2
- package/src/p521.ts +2 -2
- package/src/pasta.ts +6 -6
- package/src/secp256k1.ts +3 -3
package/esm/p256.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export declare const p256: Readonly<{
|
|
2
|
+
create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
|
|
3
|
+
CURVE: ReturnType<(curve: import("./abstract/weierstrass.js").CurveType) => Readonly<{
|
|
4
|
+
readonly nBitLength: number;
|
|
5
|
+
readonly nByteLength: number;
|
|
6
|
+
readonly Fp: import("./abstract/modular.js").IField<bigint>;
|
|
7
|
+
readonly n: bigint;
|
|
8
|
+
readonly h: bigint;
|
|
9
|
+
readonly hEff?: bigint;
|
|
10
|
+
readonly Gx: bigint;
|
|
11
|
+
readonly Gy: bigint;
|
|
12
|
+
readonly allowInfinityPoint?: boolean;
|
|
13
|
+
readonly a: bigint;
|
|
14
|
+
readonly b: bigint;
|
|
15
|
+
readonly allowedPrivateKeyLengths?: readonly number[];
|
|
16
|
+
readonly wrapPrivateKey?: boolean;
|
|
17
|
+
readonly endo?: {
|
|
18
|
+
beta: bigint;
|
|
19
|
+
splitScalar: (k: bigint) => {
|
|
20
|
+
k1neg: boolean;
|
|
21
|
+
k1: bigint;
|
|
22
|
+
k2neg: boolean;
|
|
23
|
+
k2: bigint;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => boolean) | undefined;
|
|
27
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>) | undefined;
|
|
28
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
29
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
30
|
+
readonly randomBytes: (bytesLength?: number) => Uint8Array;
|
|
31
|
+
lowS: boolean;
|
|
32
|
+
readonly bits2int?: (bytes: Uint8Array) => bigint;
|
|
33
|
+
readonly bits2int_modN?: (bytes: Uint8Array) => bigint;
|
|
34
|
+
readonly p: bigint;
|
|
35
|
+
}>>;
|
|
36
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean) => Uint8Array;
|
|
37
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean) => Uint8Array;
|
|
38
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts) => import("./abstract/weierstrass.js").RecoveredSignatureType;
|
|
39
|
+
verify: (signature: import("./abstract/utils.js").Hex | {
|
|
40
|
+
r: bigint;
|
|
41
|
+
s: bigint;
|
|
42
|
+
}, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts) => boolean;
|
|
43
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor<bigint>;
|
|
44
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
45
|
+
utils: {
|
|
46
|
+
normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
47
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
48
|
+
randomPrivateKey: () => Uint8Array;
|
|
49
|
+
precompute: (windowSize?: number, point?: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>;
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
52
|
+
export declare const secp256r1: Readonly<{
|
|
53
|
+
create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
|
|
54
|
+
CURVE: ReturnType<(curve: import("./abstract/weierstrass.js").CurveType) => Readonly<{
|
|
55
|
+
readonly nBitLength: number;
|
|
56
|
+
readonly nByteLength: number;
|
|
57
|
+
readonly Fp: import("./abstract/modular.js").IField<bigint>;
|
|
58
|
+
readonly n: bigint;
|
|
59
|
+
readonly h: bigint;
|
|
60
|
+
readonly hEff?: bigint;
|
|
61
|
+
readonly Gx: bigint;
|
|
62
|
+
readonly Gy: bigint;
|
|
63
|
+
readonly allowInfinityPoint?: boolean;
|
|
64
|
+
readonly a: bigint;
|
|
65
|
+
readonly b: bigint;
|
|
66
|
+
readonly allowedPrivateKeyLengths?: readonly number[];
|
|
67
|
+
readonly wrapPrivateKey?: boolean;
|
|
68
|
+
readonly endo?: {
|
|
69
|
+
beta: bigint;
|
|
70
|
+
splitScalar: (k: bigint) => {
|
|
71
|
+
k1neg: boolean;
|
|
72
|
+
k1: bigint;
|
|
73
|
+
k2neg: boolean;
|
|
74
|
+
k2: bigint;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => boolean) | undefined;
|
|
78
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>) | undefined;
|
|
79
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
80
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
81
|
+
readonly randomBytes: (bytesLength?: number) => Uint8Array;
|
|
82
|
+
lowS: boolean;
|
|
83
|
+
readonly bits2int?: (bytes: Uint8Array) => bigint;
|
|
84
|
+
readonly bits2int_modN?: (bytes: Uint8Array) => bigint;
|
|
85
|
+
readonly p: bigint;
|
|
86
|
+
}>>;
|
|
87
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean) => Uint8Array;
|
|
88
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean) => Uint8Array;
|
|
89
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts) => import("./abstract/weierstrass.js").RecoveredSignatureType;
|
|
90
|
+
verify: (signature: import("./abstract/utils.js").Hex | {
|
|
91
|
+
r: bigint;
|
|
92
|
+
s: bigint;
|
|
93
|
+
}, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts) => boolean;
|
|
94
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor<bigint>;
|
|
95
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
96
|
+
utils: {
|
|
97
|
+
normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
98
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
99
|
+
randomPrivateKey: () => Uint8Array;
|
|
100
|
+
precompute: (windowSize?: number, point?: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>;
|
|
101
|
+
};
|
|
102
|
+
}>;
|
|
103
|
+
export declare const hashToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts) => import("./abstract/hash-to-curve.js").H2CPoint<bigint>;
|
|
104
|
+
export declare const encodeToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts) => import("./abstract/hash-to-curve.js").H2CPoint<bigint>;
|
|
105
|
+
//# sourceMappingURL=p256.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p256.d.ts","sourceRoot":"","sources":["../src/p256.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAiCsrsB,CAAC;;;;;;kFAAwmB,CAAC;+HAA2F,CAAC;2GAAuE,CAAC;;;;qGAAoH,CAAC;;;;;;;+BAA+R,CAAC,eAAe,CAAC;;EAtBv2uB,CAAC;AACpB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAqBirsB,CAAC;;;;;;kFAAwmB,CAAC;+HAA2F,CAAC;2GAAuE,CAAC;;;;qGAAoH,CAAC;;;;;;;+BAA+R,CAAC,eAAe,CAAC;;EArB71uB,CAAC;AAmB9B,eAAO,MAAM,WAAW,2IAA4C,CAAC;AACrE,eAAO,MAAM,aAAa,2IAA8C,CAAC"}
|
package/esm/p256.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
|
-
import { createCurve } from './_shortw_utils.js';
|
|
3
2
|
import { sha256 } from '@noble/hashes/sha256';
|
|
3
|
+
import { createCurve } from './_shortw_utils.js';
|
|
4
|
+
import { createHasher } from './abstract/hash-to-curve.js';
|
|
4
5
|
import { Field } from './abstract/modular.js';
|
|
5
6
|
import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';
|
|
6
|
-
import { createHasher } from './abstract/hash-to-curve.js';
|
|
7
7
|
// NIST secp256r1 aka p256
|
|
8
8
|
// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-256
|
|
9
9
|
const Fp = Field(BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff'));
|
package/esm/p256.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p256.js","sourceRoot":"","sources":["../src/p256.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"p256.js","sourceRoot":"","sources":["../src/p256.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,0BAA0B;AAC1B,0EAA0E;AAE1E,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,oEAAoE,CAAC,CAAC,CAAC;AAC/F,MAAM,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,MAAM,OAAO,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAE7F,kBAAkB;AAClB,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAC;IAC9B,CAAC,EAAE,OAAO,EAAE,wBAAwB;IACpC,CAAC,EAAE,OAAO;IACV,EAAE,EAAE,yDAAyD;IAC7D,wDAAwD;IACxD,CAAC,EAAE,MAAM,CAAC,oEAAoE,CAAC;IAC/E,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC,oEAAoE,CAAC;IAChF,EAAE,EAAE,MAAM,CAAC,oEAAoE,CAAC;IAChF,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACZ,IAAI,EAAE,KAAK;CACH,EAAE,MAAM,CAAC,CAAC;AACpB,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;AAE9B,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CACnC,mBAAmB,CAAC,EAAE,EAAE;IACtB,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;CAC5B,CAAC,CAAC,EAAE,CAAC;AAER,MAAM,GAAG,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAChC,YAAY,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,OAAiB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;IACjF,GAAG,EAAE,2BAA2B;IAChC,SAAS,EAAE,2BAA2B;IACtC,CAAC,EAAE,EAAE,CAAC,KAAK;IACX,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,GAAG;IACN,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,MAAM;CACb,CAAC,CAAC,EAAE,CAAC;AACR,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC"}
|
package/esm/p384.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export declare const p384: Readonly<{
|
|
2
|
+
create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
|
|
3
|
+
CURVE: ReturnType<(curve: import("./abstract/weierstrass.js").CurveType) => Readonly<{
|
|
4
|
+
readonly nBitLength: number;
|
|
5
|
+
readonly nByteLength: number;
|
|
6
|
+
readonly Fp: import("./abstract/modular.js").IField<bigint>;
|
|
7
|
+
readonly n: bigint;
|
|
8
|
+
readonly h: bigint;
|
|
9
|
+
readonly hEff?: bigint;
|
|
10
|
+
readonly Gx: bigint;
|
|
11
|
+
readonly Gy: bigint;
|
|
12
|
+
readonly allowInfinityPoint?: boolean;
|
|
13
|
+
readonly a: bigint;
|
|
14
|
+
readonly b: bigint;
|
|
15
|
+
readonly allowedPrivateKeyLengths?: readonly number[];
|
|
16
|
+
readonly wrapPrivateKey?: boolean;
|
|
17
|
+
readonly endo?: {
|
|
18
|
+
beta: bigint;
|
|
19
|
+
splitScalar: (k: bigint) => {
|
|
20
|
+
k1neg: boolean;
|
|
21
|
+
k1: bigint;
|
|
22
|
+
k2neg: boolean;
|
|
23
|
+
k2: bigint;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => boolean) | undefined;
|
|
27
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>) | undefined;
|
|
28
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
29
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
30
|
+
readonly randomBytes: (bytesLength?: number) => Uint8Array;
|
|
31
|
+
lowS: boolean;
|
|
32
|
+
readonly bits2int?: (bytes: Uint8Array) => bigint;
|
|
33
|
+
readonly bits2int_modN?: (bytes: Uint8Array) => bigint;
|
|
34
|
+
readonly p: bigint;
|
|
35
|
+
}>>;
|
|
36
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean) => Uint8Array;
|
|
37
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean) => Uint8Array;
|
|
38
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts) => import("./abstract/weierstrass.js").RecoveredSignatureType;
|
|
39
|
+
verify: (signature: import("./abstract/utils.js").Hex | {
|
|
40
|
+
r: bigint;
|
|
41
|
+
s: bigint;
|
|
42
|
+
}, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts) => boolean;
|
|
43
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor<bigint>;
|
|
44
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
45
|
+
utils: {
|
|
46
|
+
normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
47
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
48
|
+
randomPrivateKey: () => Uint8Array;
|
|
49
|
+
precompute: (windowSize?: number, point?: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>;
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
52
|
+
export declare const secp384r1: Readonly<{
|
|
53
|
+
create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
|
|
54
|
+
CURVE: ReturnType<(curve: import("./abstract/weierstrass.js").CurveType) => Readonly<{
|
|
55
|
+
readonly nBitLength: number;
|
|
56
|
+
readonly nByteLength: number;
|
|
57
|
+
readonly Fp: import("./abstract/modular.js").IField<bigint>;
|
|
58
|
+
readonly n: bigint;
|
|
59
|
+
readonly h: bigint;
|
|
60
|
+
readonly hEff?: bigint;
|
|
61
|
+
readonly Gx: bigint;
|
|
62
|
+
readonly Gy: bigint;
|
|
63
|
+
readonly allowInfinityPoint?: boolean;
|
|
64
|
+
readonly a: bigint;
|
|
65
|
+
readonly b: bigint;
|
|
66
|
+
readonly allowedPrivateKeyLengths?: readonly number[];
|
|
67
|
+
readonly wrapPrivateKey?: boolean;
|
|
68
|
+
readonly endo?: {
|
|
69
|
+
beta: bigint;
|
|
70
|
+
splitScalar: (k: bigint) => {
|
|
71
|
+
k1neg: boolean;
|
|
72
|
+
k1: bigint;
|
|
73
|
+
k2neg: boolean;
|
|
74
|
+
k2: bigint;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => boolean) | undefined;
|
|
78
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>) | undefined;
|
|
79
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
80
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
81
|
+
readonly randomBytes: (bytesLength?: number) => Uint8Array;
|
|
82
|
+
lowS: boolean;
|
|
83
|
+
readonly bits2int?: (bytes: Uint8Array) => bigint;
|
|
84
|
+
readonly bits2int_modN?: (bytes: Uint8Array) => bigint;
|
|
85
|
+
readonly p: bigint;
|
|
86
|
+
}>>;
|
|
87
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean) => Uint8Array;
|
|
88
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean) => Uint8Array;
|
|
89
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts) => import("./abstract/weierstrass.js").RecoveredSignatureType;
|
|
90
|
+
verify: (signature: import("./abstract/utils.js").Hex | {
|
|
91
|
+
r: bigint;
|
|
92
|
+
s: bigint;
|
|
93
|
+
}, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts) => boolean;
|
|
94
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor<bigint>;
|
|
95
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
96
|
+
utils: {
|
|
97
|
+
normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
98
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
99
|
+
randomPrivateKey: () => Uint8Array;
|
|
100
|
+
precompute: (windowSize?: number, point?: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>;
|
|
101
|
+
};
|
|
102
|
+
}>;
|
|
103
|
+
export declare const hashToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts) => import("./abstract/hash-to-curve.js").H2CPoint<bigint>;
|
|
104
|
+
export declare const encodeToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts) => import("./abstract/hash-to-curve.js").H2CPoint<bigint>;
|
|
105
|
+
//# sourceMappingURL=p384.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p384.d.ts","sourceRoot":"","sources":["../src/p384.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAiC07rB,CAAC;;;;;;kFAAwmB,CAAC;+HAA2F,CAAC;2GAAuE,CAAC;;;;qGAAoH,CAAC;;;;;;;+BAA+R,CAAC,eAAe,CAAC;;EAtB3muB,CAAC;AACpB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAqBq7rB,CAAC;;;;;;kFAAwmB,CAAC;+HAA2F,CAAC;2GAAuE,CAAC;;;;qGAAoH,CAAC;;;;;;;+BAA+R,CAAC,eAAe,CAAC;;EArBjmuB,CAAC;AAmB9B,eAAO,MAAM,WAAW,2IAA4C,CAAC;AACrE,eAAO,MAAM,aAAa,2IAA8C,CAAC"}
|
package/esm/p384.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
|
-
import { createCurve } from './_shortw_utils.js';
|
|
3
2
|
import { sha384 } from '@noble/hashes/sha512';
|
|
3
|
+
import { createCurve } from './_shortw_utils.js';
|
|
4
|
+
import { createHasher } from './abstract/hash-to-curve.js';
|
|
4
5
|
import { Field } from './abstract/modular.js';
|
|
5
6
|
import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';
|
|
6
|
-
import { createHasher } from './abstract/hash-to-curve.js';
|
|
7
7
|
// NIST secp384r1 aka p384
|
|
8
8
|
// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-384
|
|
9
9
|
// Field over which we'll do calculations.
|
package/esm/p384.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p384.js","sourceRoot":"","sources":["../src/p384.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"p384.js","sourceRoot":"","sources":["../src/p384.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,0BAA0B;AAC1B,0EAA0E;AAE1E,0CAA0C;AAC1C,kBAAkB;AAClB,MAAM,CAAC,GAAG,MAAM,CAAC,oGAAoG,CAAC,CAAC;AACvH,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACpB,MAAM,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM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CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC"}
|
package/esm/p521.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export declare const p521: Readonly<{
|
|
2
|
+
create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
|
|
3
|
+
CURVE: ReturnType<(curve: import("./abstract/weierstrass.js").CurveType) => Readonly<{
|
|
4
|
+
readonly nBitLength: number;
|
|
5
|
+
readonly nByteLength: number;
|
|
6
|
+
readonly Fp: import("./abstract/modular.js").IField<bigint>;
|
|
7
|
+
readonly n: bigint;
|
|
8
|
+
readonly h: bigint;
|
|
9
|
+
readonly hEff?: bigint;
|
|
10
|
+
readonly Gx: bigint;
|
|
11
|
+
readonly Gy: bigint;
|
|
12
|
+
readonly allowInfinityPoint?: boolean;
|
|
13
|
+
readonly a: bigint;
|
|
14
|
+
readonly b: bigint;
|
|
15
|
+
readonly allowedPrivateKeyLengths?: readonly number[];
|
|
16
|
+
readonly wrapPrivateKey?: boolean;
|
|
17
|
+
readonly endo?: {
|
|
18
|
+
beta: bigint;
|
|
19
|
+
splitScalar: (k: bigint) => {
|
|
20
|
+
k1neg: boolean;
|
|
21
|
+
k1: bigint;
|
|
22
|
+
k2neg: boolean;
|
|
23
|
+
k2: bigint;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => boolean) | undefined;
|
|
27
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>) | undefined;
|
|
28
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
29
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
30
|
+
readonly randomBytes: (bytesLength?: number) => Uint8Array;
|
|
31
|
+
lowS: boolean;
|
|
32
|
+
readonly bits2int?: (bytes: Uint8Array) => bigint;
|
|
33
|
+
readonly bits2int_modN?: (bytes: Uint8Array) => bigint;
|
|
34
|
+
readonly p: bigint;
|
|
35
|
+
}>>;
|
|
36
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean) => Uint8Array;
|
|
37
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean) => Uint8Array;
|
|
38
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts) => import("./abstract/weierstrass.js").RecoveredSignatureType;
|
|
39
|
+
verify: (signature: import("./abstract/utils.js").Hex | {
|
|
40
|
+
r: bigint;
|
|
41
|
+
s: bigint;
|
|
42
|
+
}, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts) => boolean;
|
|
43
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor<bigint>;
|
|
44
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
45
|
+
utils: {
|
|
46
|
+
normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
47
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
48
|
+
randomPrivateKey: () => Uint8Array;
|
|
49
|
+
precompute: (windowSize?: number, point?: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>;
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
52
|
+
export declare const secp521r1: Readonly<{
|
|
53
|
+
create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
|
|
54
|
+
CURVE: ReturnType<(curve: import("./abstract/weierstrass.js").CurveType) => Readonly<{
|
|
55
|
+
readonly nBitLength: number;
|
|
56
|
+
readonly nByteLength: number;
|
|
57
|
+
readonly Fp: import("./abstract/modular.js").IField<bigint>;
|
|
58
|
+
readonly n: bigint;
|
|
59
|
+
readonly h: bigint;
|
|
60
|
+
readonly hEff?: bigint;
|
|
61
|
+
readonly Gx: bigint;
|
|
62
|
+
readonly Gy: bigint;
|
|
63
|
+
readonly allowInfinityPoint?: boolean;
|
|
64
|
+
readonly a: bigint;
|
|
65
|
+
readonly b: bigint;
|
|
66
|
+
readonly allowedPrivateKeyLengths?: readonly number[];
|
|
67
|
+
readonly wrapPrivateKey?: boolean;
|
|
68
|
+
readonly endo?: {
|
|
69
|
+
beta: bigint;
|
|
70
|
+
splitScalar: (k: bigint) => {
|
|
71
|
+
k1neg: boolean;
|
|
72
|
+
k1: bigint;
|
|
73
|
+
k2neg: boolean;
|
|
74
|
+
k2: bigint;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => boolean) | undefined;
|
|
78
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>) | undefined;
|
|
79
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
80
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
81
|
+
readonly randomBytes: (bytesLength?: number) => Uint8Array;
|
|
82
|
+
lowS: boolean;
|
|
83
|
+
readonly bits2int?: (bytes: Uint8Array) => bigint;
|
|
84
|
+
readonly bits2int_modN?: (bytes: Uint8Array) => bigint;
|
|
85
|
+
readonly p: bigint;
|
|
86
|
+
}>>;
|
|
87
|
+
getPublicKey: (privateKey: import("./abstract/utils.js").PrivKey, isCompressed?: boolean) => Uint8Array;
|
|
88
|
+
getSharedSecret: (privateA: import("./abstract/utils.js").PrivKey, publicB: import("./abstract/utils.js").Hex, isCompressed?: boolean) => Uint8Array;
|
|
89
|
+
sign: (msgHash: import("./abstract/utils.js").Hex, privKey: import("./abstract/utils.js").PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts) => import("./abstract/weierstrass.js").RecoveredSignatureType;
|
|
90
|
+
verify: (signature: import("./abstract/utils.js").Hex | {
|
|
91
|
+
r: bigint;
|
|
92
|
+
s: bigint;
|
|
93
|
+
}, msgHash: import("./abstract/utils.js").Hex, publicKey: import("./abstract/utils.js").Hex, opts?: import("./abstract/weierstrass.js").VerOpts) => boolean;
|
|
94
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor<bigint>;
|
|
95
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
96
|
+
utils: {
|
|
97
|
+
normPrivateKeyToScalar: (key: import("./abstract/utils.js").PrivKey) => bigint;
|
|
98
|
+
isValidPrivateKey(privateKey: import("./abstract/utils.js").PrivKey): boolean;
|
|
99
|
+
randomPrivateKey: () => Uint8Array;
|
|
100
|
+
precompute: (windowSize?: number, point?: import("./abstract/weierstrass.js").ProjPointType<bigint>) => import("./abstract/weierstrass.js").ProjPointType<bigint>;
|
|
101
|
+
};
|
|
102
|
+
}>;
|
|
103
|
+
export declare const hashToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts) => import("./abstract/hash-to-curve.js").H2CPoint<bigint>;
|
|
104
|
+
export declare const encodeToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts) => import("./abstract/hash-to-curve.js").H2CPoint<bigint>;
|
|
105
|
+
//# sourceMappingURL=p521.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p521.d.ts","sourceRoot":"","sources":["../src/p521.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAiCijrB,CAAC;;;;;;kFAAwmB,CAAC;+HAA2F,CAAC;2GAAuE,CAAC;;;;qGAAoH,CAAC;;;;;;;+BAA+R,CAAC,eAAe,CAAC;;EAtBlutB,CAAC;AACpB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAqB4irB,CAAC;;;;;;kFAAwmB,CAAC;+HAA2F,CAAC;2GAAuE,CAAC;;;;qGAAoH,CAAC;;;;;;;+BAA+R,CAAC,eAAe,CAAC;;EArBxttB,CAAC;AAmB9B,eAAO,MAAM,WAAW,2IAA4C,CAAC;AACrE,eAAO,MAAM,aAAa,2IAA8C,CAAC"}
|
package/esm/p521.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
|
-
import { createCurve } from './_shortw_utils.js';
|
|
3
2
|
import { sha512 } from '@noble/hashes/sha512';
|
|
3
|
+
import { createCurve } from './_shortw_utils.js';
|
|
4
|
+
import { createHasher } from './abstract/hash-to-curve.js';
|
|
4
5
|
import { Field } from './abstract/modular.js';
|
|
5
6
|
import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';
|
|
6
|
-
import { createHasher } from './abstract/hash-to-curve.js';
|
|
7
7
|
// NIST secp521r1 aka p521
|
|
8
8
|
// Note that it's 521, which differs from 512 of its hash function.
|
|
9
9
|
// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-521
|
package/esm/p521.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p521.js","sourceRoot":"","sources":["../src/p521.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"p521.js","sourceRoot":"","sources":["../src/p521.ts"],"names":[],"mappings":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package/esm/pasta.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
2
|
import { sha256 } from '@noble/hashes/sha256';
|
|
3
|
-
import { weierstrass } from './abstract/weierstrass.js';
|
|
4
3
|
import { getHash } from './_shortw_utils.js';
|
|
5
|
-
import
|
|
4
|
+
import { Field, mod } from './abstract/modular.js';
|
|
5
|
+
import { weierstrass } from './abstract/weierstrass.js';
|
|
6
6
|
export const p = BigInt('0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001');
|
|
7
7
|
export const q = BigInt('0x40000000000000000000000000000000224698fc0994a8dd8c46eb2100000001');
|
|
8
8
|
// https://neuromancer.sk/std/other/Pallas
|
|
9
9
|
export const pallas = weierstrass({
|
|
10
10
|
a: BigInt(0),
|
|
11
11
|
b: BigInt(5),
|
|
12
|
-
Fp:
|
|
12
|
+
Fp: Field(p),
|
|
13
13
|
n: q,
|
|
14
|
-
Gx: mod
|
|
14
|
+
Gx: mod(BigInt(-1), p),
|
|
15
15
|
Gy: BigInt(2),
|
|
16
16
|
h: BigInt(1),
|
|
17
17
|
...getHash(sha256),
|
|
@@ -20,9 +20,9 @@ export const pallas = weierstrass({
|
|
|
20
20
|
export const vesta = weierstrass({
|
|
21
21
|
a: BigInt(0),
|
|
22
22
|
b: BigInt(5),
|
|
23
|
-
Fp:
|
|
23
|
+
Fp: Field(q),
|
|
24
24
|
n: p,
|
|
25
|
-
Gx: mod
|
|
25
|
+
Gx: mod(BigInt(-1), q),
|
|
26
26
|
Gy: BigInt(2),
|
|
27
27
|
h: BigInt(1),
|
|
28
28
|
...getHash(sha256),
|
package/esm/pasta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pasta.js","sourceRoot":"","sources":["../src/pasta.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAA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,MAAM,CAAC,CAAC,CAAC;IACZ,GAAG,OAAO,CAAC,MAAM,CAAC;CACnB,CAAC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { mod } from './abstract/modular.js';
|
|
2
|
+
import type { Hex, PrivKey } from './abstract/utils.js';
|
|
3
|
+
import { bytesToNumberBE, numberToBytesBE } from './abstract/utils.js';
|
|
4
|
+
import { ProjPointType as PointType } from './abstract/weierstrass.js';
|
|
5
|
+
export declare const secp256k1: Readonly<{
|
|
6
|
+
create: (hash: import("./abstract/utils.js").CHash) => import("./abstract/weierstrass.js").CurveFn;
|
|
7
|
+
CURVE: ReturnType<(curve: import("./abstract/weierstrass.js").CurveType) => Readonly<{
|
|
8
|
+
readonly nBitLength: number;
|
|
9
|
+
readonly nByteLength: number;
|
|
10
|
+
readonly Fp: import("./abstract/modular.js").IField<bigint>;
|
|
11
|
+
readonly n: bigint;
|
|
12
|
+
readonly h: bigint;
|
|
13
|
+
readonly hEff?: bigint;
|
|
14
|
+
readonly Gx: bigint;
|
|
15
|
+
readonly Gy: bigint;
|
|
16
|
+
readonly allowInfinityPoint?: boolean;
|
|
17
|
+
readonly a: bigint;
|
|
18
|
+
readonly b: bigint;
|
|
19
|
+
readonly allowedPrivateKeyLengths?: readonly number[];
|
|
20
|
+
readonly wrapPrivateKey?: boolean;
|
|
21
|
+
readonly endo?: {
|
|
22
|
+
beta: bigint;
|
|
23
|
+
splitScalar: (k: bigint) => {
|
|
24
|
+
k1neg: boolean;
|
|
25
|
+
k1: bigint;
|
|
26
|
+
k2neg: boolean;
|
|
27
|
+
k2: bigint;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
readonly isTorsionFree?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: PointType<bigint>) => boolean) | undefined;
|
|
31
|
+
readonly clearCofactor?: ((c: import("./abstract/weierstrass.js").ProjConstructor<bigint>, point: PointType<bigint>) => PointType<bigint>) | undefined;
|
|
32
|
+
readonly hash: import("./abstract/utils.js").CHash;
|
|
33
|
+
readonly hmac: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
|
|
34
|
+
readonly randomBytes: (bytesLength?: number) => Uint8Array;
|
|
35
|
+
lowS: boolean;
|
|
36
|
+
readonly bits2int?: (bytes: Uint8Array) => bigint;
|
|
37
|
+
readonly bits2int_modN?: (bytes: Uint8Array) => bigint;
|
|
38
|
+
readonly p: bigint;
|
|
39
|
+
}>>;
|
|
40
|
+
getPublicKey: (privateKey: PrivKey, isCompressed?: boolean) => Uint8Array;
|
|
41
|
+
getSharedSecret: (privateA: PrivKey, publicB: Hex, isCompressed?: boolean) => Uint8Array;
|
|
42
|
+
sign: (msgHash: Hex, privKey: PrivKey, opts?: import("./abstract/weierstrass.js").SignOpts) => import("./abstract/weierstrass.js").RecoveredSignatureType;
|
|
43
|
+
verify: (signature: Hex | {
|
|
44
|
+
r: bigint;
|
|
45
|
+
s: bigint;
|
|
46
|
+
}, msgHash: Hex, publicKey: Hex, opts?: import("./abstract/weierstrass.js").VerOpts) => boolean;
|
|
47
|
+
ProjectivePoint: import("./abstract/weierstrass.js").ProjConstructor<bigint>;
|
|
48
|
+
Signature: import("./abstract/weierstrass.js").SignatureConstructor;
|
|
49
|
+
utils: {
|
|
50
|
+
normPrivateKeyToScalar: (key: PrivKey) => bigint;
|
|
51
|
+
isValidPrivateKey(privateKey: PrivKey): boolean;
|
|
52
|
+
randomPrivateKey: () => Uint8Array;
|
|
53
|
+
precompute: (windowSize?: number, point?: PointType<bigint>) => PointType<bigint>;
|
|
54
|
+
};
|
|
55
|
+
}>;
|
|
56
|
+
declare function taggedHash(tag: string, ...messages: Uint8Array[]): Uint8Array;
|
|
57
|
+
/**
|
|
58
|
+
* lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point.
|
|
59
|
+
* @returns valid point checked for being on-curve
|
|
60
|
+
*/
|
|
61
|
+
declare function lift_x(x: bigint): PointType<bigint>;
|
|
62
|
+
/**
|
|
63
|
+
* Schnorr public key is just `x` coordinate of Point as per BIP340.
|
|
64
|
+
*/
|
|
65
|
+
declare function schnorrGetPublicKey(privateKey: Hex): Uint8Array;
|
|
66
|
+
/**
|
|
67
|
+
* Creates Schnorr signature as per BIP340. Verifies itself before returning anything.
|
|
68
|
+
* auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous.
|
|
69
|
+
*/
|
|
70
|
+
declare function schnorrSign(message: Hex, privateKey: PrivKey, auxRand?: Hex): Uint8Array;
|
|
71
|
+
/**
|
|
72
|
+
* Verifies Schnorr signature.
|
|
73
|
+
* Will swallow errors & return false except for initial type validation of arguments.
|
|
74
|
+
*/
|
|
75
|
+
declare function schnorrVerify(signature: Hex, message: Hex, publicKey: Hex): boolean;
|
|
76
|
+
export declare const schnorr: {
|
|
77
|
+
getPublicKey: typeof schnorrGetPublicKey;
|
|
78
|
+
sign: typeof schnorrSign;
|
|
79
|
+
verify: typeof schnorrVerify;
|
|
80
|
+
utils: {
|
|
81
|
+
randomPrivateKey: () => Uint8Array;
|
|
82
|
+
lift_x: typeof lift_x;
|
|
83
|
+
pointToBytes: (point: PointType<bigint>) => Uint8Array;
|
|
84
|
+
numberToBytesBE: typeof numberToBytesBE;
|
|
85
|
+
bytesToNumberBE: typeof bytesToNumberBE;
|
|
86
|
+
taggedHash: typeof taggedHash;
|
|
87
|
+
mod: typeof mod;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export declare const hashToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts) => import("./abstract/hash-to-curve.js").H2CPoint<bigint>;
|
|
91
|
+
export declare const encodeToCurve: (msg: Uint8Array, options?: import("./abstract/hash-to-curve.js").htfBasicOpts) => import("./abstract/hash-to-curve.js").H2CPoint<bigint>;
|
|
92
|
+
export {};
|
|
93
|
+
//# sourceMappingURL=secp256k1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secp256k1.d.ts","sourceRoot":"","sources":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IT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
2
|
import { sha256 } from '@noble/hashes/sha256';
|
|
3
3
|
import { randomBytes } from '@noble/hashes/utils';
|
|
4
|
+
import { createCurve } from './_shortw_utils.js';
|
|
5
|
+
import { createHasher, isogenyMap } from './abstract/hash-to-curve.js';
|
|
4
6
|
import { Field, mod, pow2 } from './abstract/modular.js';
|
|
5
|
-
import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';
|
|
6
7
|
import { bytesToNumberBE, concatBytes, ensureBytes, numberToBytesBE } from './abstract/utils.js';
|
|
7
|
-
import {
|
|
8
|
-
import { createCurve } from './_shortw_utils.js';
|
|
8
|
+
import { mapToCurveSimpleSWU } from './abstract/weierstrass.js';
|
|
9
9
|
const secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f');
|
|
10
10
|
const secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141');
|
|
11
11
|
const _1n = BigInt(1);
|