@noble/post-quantum 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/README.md +300 -0
- package/_crystals.d.ts +34 -0
- package/_crystals.d.ts.map +1 -0
- package/_crystals.js +171 -0
- package/_crystals.js.map +1 -0
- package/esm/_crystals.js +167 -0
- package/esm/_crystals.js.map +1 -0
- package/esm/index.js +3 -0
- package/esm/index.js.map +1 -0
- package/esm/ml-dsa.js +529 -0
- package/esm/ml-dsa.js.map +1 -0
- package/esm/ml-kem.js +361 -0
- package/esm/ml-kem.js.map +1 -0
- package/esm/package.json +10 -0
- package/esm/slh-dsa.js +602 -0
- package/esm/slh-dsa.js.map +1 -0
- package/esm/utils.js +86 -0
- package/esm/utils.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -0
- package/index.js +3 -0
- package/index.js.map +1 -0
- package/ml-dsa.d.ts +37 -0
- package/ml-dsa.d.ts.map +1 -0
- package/ml-dsa.js +532 -0
- package/ml-dsa.js.map +1 -0
- package/ml-kem.d.ts +134 -0
- package/ml-kem.d.ts.map +1 -0
- package/ml-kem.js +364 -0
- package/ml-kem.js.map +1 -0
- package/package.json +100 -0
- package/slh-dsa.d.ts +70 -0
- package/slh-dsa.d.ts.map +1 -0
- package/slh-dsa.js +605 -0
- package/slh-dsa.js.map +1 -0
- package/src/_crystals.ts +197 -0
- package/src/index.ts +1 -0
- package/src/ml-dsa.ts +569 -0
- package/src/ml-kem.ts +403 -0
- package/src/package.json +3 -0
- package/src/slh-dsa.ts +771 -0
- package/src/utils.ts +113 -0
- package/utils.d.ts +38 -0
- package/utils.d.ts.map +1 -0
- package/utils.js +94 -0
- package/utils.js.map +1 -0
package/package.json
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
{
|
2
|
+
"name": "@noble/post-quantum",
|
3
|
+
"version": "0.1.0",
|
4
|
+
"description": "Auditable & minimal JS implementation of public-key post-quantum cryptography",
|
5
|
+
"files": [
|
6
|
+
"esm",
|
7
|
+
"src",
|
8
|
+
"*.js",
|
9
|
+
"*.js.map",
|
10
|
+
"*.d.ts",
|
11
|
+
"*.d.ts.map"
|
12
|
+
],
|
13
|
+
"scripts": {
|
14
|
+
"bench": "node benchmark/ml-kem.js noble; node benchmark/ml-dsa.js noble; node benchmark/slh-dsa.js noble",
|
15
|
+
"bench:all": "node benchmark/{ml-kem,ml-dsa,slh-dsa}.js",
|
16
|
+
"bench:install": "cd benchmark && npm install && cd ../../",
|
17
|
+
"build": "npm run build:clean; tsc && tsc -p tsconfig.esm.json",
|
18
|
+
"build:release": "cd build; npm i; npm run build",
|
19
|
+
"build:clean": "rm *.{js,d.ts,js.map,d.ts.map} esm/*.{js,d.ts,js.map,d.ts.map} 2> /dev/null",
|
20
|
+
"lint": "prettier --check 'src/**/*.{js,ts}' 'test/**/*.{js,ts,mjs}'",
|
21
|
+
"format": "prettier --write 'src/**/*.{js,ts}' 'test/**/*.{js,ts,mjs}'",
|
22
|
+
"test": "node test/index.js"
|
23
|
+
},
|
24
|
+
"author": "Paul Miller (https://paulmillr.com)",
|
25
|
+
"homepage": "https://paulmillr.com/noble/",
|
26
|
+
"repository": {
|
27
|
+
"type": "git",
|
28
|
+
"url": "git+https://github.com/paulmillr/noble-post-quantum.git"
|
29
|
+
},
|
30
|
+
"license": "MIT",
|
31
|
+
"sideEffects": false,
|
32
|
+
"dependencies": {
|
33
|
+
"@noble/ciphers": "0.5.2",
|
34
|
+
"@noble/hashes": "1.4.0"
|
35
|
+
},
|
36
|
+
"devDependencies": {
|
37
|
+
"@paulmillr/jsbt": "0.1.0",
|
38
|
+
"@scure/base": "1.1.5",
|
39
|
+
"micro-bmark": "0.3.1",
|
40
|
+
"micro-should": "0.4.0",
|
41
|
+
"prettier": "3.1.1",
|
42
|
+
"typescript": "5.3.2"
|
43
|
+
},
|
44
|
+
"main": "index.js",
|
45
|
+
"exports": {
|
46
|
+
".": {
|
47
|
+
"types": "./index.d.ts",
|
48
|
+
"import": "./esm/index.js",
|
49
|
+
"default": "./index.js"
|
50
|
+
},
|
51
|
+
"./index": {
|
52
|
+
"types": "./index.d.ts",
|
53
|
+
"import": "./esm/index.js",
|
54
|
+
"default": "./index.js"
|
55
|
+
},
|
56
|
+
"./_crystals": {
|
57
|
+
"types": "./_crystals.d.ts",
|
58
|
+
"import": "./esm/_crystals.js",
|
59
|
+
"default": "./_crystals.js"
|
60
|
+
},
|
61
|
+
"./ml-dsa": {
|
62
|
+
"types": "./ml-dsa.d.ts",
|
63
|
+
"import": "./esm/ml-dsa.js",
|
64
|
+
"default": "./ml-dsa.js"
|
65
|
+
},
|
66
|
+
"./ml-kem": {
|
67
|
+
"types": "./ml-kem.d.ts",
|
68
|
+
"import": "./esm/ml-kem.js",
|
69
|
+
"default": "./ml-kem.js"
|
70
|
+
},
|
71
|
+
"./slh-dsa": {
|
72
|
+
"types": "./slh-dsa.d.ts",
|
73
|
+
"import": "./esm/slh-dsa.js",
|
74
|
+
"default": "./slh-dsa.js"
|
75
|
+
},
|
76
|
+
"./utils": {
|
77
|
+
"types": "./utils.d.ts",
|
78
|
+
"import": "./esm/utils.js",
|
79
|
+
"default": "./utils.js"
|
80
|
+
}
|
81
|
+
},
|
82
|
+
"keywords": [
|
83
|
+
"ml-kem",
|
84
|
+
"ml-dsa",
|
85
|
+
"slh-dsa",
|
86
|
+
"kyber",
|
87
|
+
"dilithium",
|
88
|
+
"sphincs",
|
89
|
+
"fips203",
|
90
|
+
"fips204",
|
91
|
+
"fips205",
|
92
|
+
"pqc",
|
93
|
+
"post-quantum",
|
94
|
+
"public-key",
|
95
|
+
"crypto",
|
96
|
+
"noble",
|
97
|
+
"cryptography"
|
98
|
+
],
|
99
|
+
"funding": "https://paulmillr.com/funding/"
|
100
|
+
}
|
package/slh-dsa.d.ts
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
import { Signer } from './utils.js';
|
2
|
+
/**
|
3
|
+
* * N: Security parameter (in bytes). W: Winternitz parameter
|
4
|
+
* * H: Hypertree height. D: Hypertree layers
|
5
|
+
* * K: FORS trees numbers. A: FORS trees height
|
6
|
+
*/
|
7
|
+
export type SphincsOpts = {
|
8
|
+
N: number;
|
9
|
+
W: number;
|
10
|
+
H: number;
|
11
|
+
D: number;
|
12
|
+
K: number;
|
13
|
+
A: number;
|
14
|
+
};
|
15
|
+
export type SphincsHashOpts = {
|
16
|
+
isCompressed?: boolean;
|
17
|
+
getContext: GetContext;
|
18
|
+
};
|
19
|
+
export declare const PARAMS: Record<string, SphincsOpts>;
|
20
|
+
export type ADRS = Uint8Array;
|
21
|
+
type Context = {
|
22
|
+
PRFaddr: (addr: ADRS) => Uint8Array;
|
23
|
+
PRFmsg: (skPRF: Uint8Array, random: Uint8Array, msg: Uint8Array) => Uint8Array;
|
24
|
+
Hmsg: (R: Uint8Array, pk: Uint8Array, m: Uint8Array, outLen: number) => Uint8Array;
|
25
|
+
thash1: (input: Uint8Array, addr: ADRS) => Uint8Array;
|
26
|
+
thashN: (blocks: number, input: Uint8Array, addr: ADRS) => Uint8Array;
|
27
|
+
clean: () => void;
|
28
|
+
};
|
29
|
+
export type GetContext = (opts: SphincsOpts) => (pub_seed: Uint8Array, sk_seed?: Uint8Array) => Context;
|
30
|
+
type SphincsSigner = Signer & {
|
31
|
+
seedLen: number;
|
32
|
+
};
|
33
|
+
export declare const sphincs_shake_128f_simple: SphincsSigner;
|
34
|
+
export declare const sphincs_shake_128f_robust: SphincsSigner;
|
35
|
+
export declare const sphincs_shake_128s_simple: SphincsSigner;
|
36
|
+
export declare const sphincs_shake_128s_robust: SphincsSigner;
|
37
|
+
export declare const sphincs_shake_192f_simple: SphincsSigner;
|
38
|
+
export declare const sphincs_shake_192f_robust: SphincsSigner;
|
39
|
+
export declare const sphincs_shake_192s_simple: SphincsSigner;
|
40
|
+
export declare const sphincs_shake_192s_robust: SphincsSigner;
|
41
|
+
export declare const sphincs_shake_256f_simple: SphincsSigner;
|
42
|
+
export declare const sphincs_shake_256f_robust: SphincsSigner;
|
43
|
+
export declare const sphincs_shake_256s_simple: SphincsSigner;
|
44
|
+
export declare const sphincs_shake_256s_robust: SphincsSigner;
|
45
|
+
export declare const slh_dsa_shake_128f: SphincsSigner;
|
46
|
+
export declare const slh_dsa_shake_128s: SphincsSigner;
|
47
|
+
export declare const slh_dsa_shake_192f: SphincsSigner;
|
48
|
+
export declare const slh_dsa_shake_192s: SphincsSigner;
|
49
|
+
export declare const slh_dsa_shake_256f: SphincsSigner;
|
50
|
+
export declare const slh_dsa_shake_256s: SphincsSigner;
|
51
|
+
export declare const sphincs_sha2_128f_simple: SphincsSigner;
|
52
|
+
export declare const sphincs_sha2_128f_robust: SphincsSigner;
|
53
|
+
export declare const sphincs_sha2_128s_simple: SphincsSigner;
|
54
|
+
export declare const sphincs_sha2_128s_robust: SphincsSigner;
|
55
|
+
export declare const sphincs_sha2_192f_simple: SphincsSigner;
|
56
|
+
export declare const sphincs_sha2_192f_robust: SphincsSigner;
|
57
|
+
export declare const sphincs_sha2_192s_simple: SphincsSigner;
|
58
|
+
export declare const sphincs_sha2_192s_robust: SphincsSigner;
|
59
|
+
export declare const sphincs_sha2_256f_simple: SphincsSigner;
|
60
|
+
export declare const sphincs_sha2_256f_robust: SphincsSigner;
|
61
|
+
export declare const sphincs_sha2_256s_simple: SphincsSigner;
|
62
|
+
export declare const sphincs_sha2_256s_robust: SphincsSigner;
|
63
|
+
export declare const slh_dsa_sha2_128f: SphincsSigner;
|
64
|
+
export declare const slh_dsa_sha2_128s: SphincsSigner;
|
65
|
+
export declare const slh_dsa_sha2_192f: SphincsSigner;
|
66
|
+
export declare const slh_dsa_sha2_192s: SphincsSigner;
|
67
|
+
export declare const slh_dsa_sha2_256f: SphincsSigner;
|
68
|
+
export declare const slh_dsa_sha2_256s: SphincsSigner;
|
69
|
+
export {};
|
70
|
+
//# sourceMappingURL=slh-dsa.d.ts.map
|
package/slh-dsa.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"slh-dsa.d.ts","sourceRoot":"","sources":["src/sl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