slh-dsa 0.0.3 → 0.0.4

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 CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # @noble/post-quantum-simple
2
+ # SLH-DSA/Sphincs+
3
3
 
4
4
  A lightweight wrapper around [@noble/post-quantum](https://github.com/paulmillr/noble-post-quantum) providing a simplified interface for SLH-DSA (SPHINCS+) stateless hash-based signatures.
5
5
 
@@ -40,6 +40,7 @@ Created a new SLH-DSA instance with the specified algorithm.
40
40
 
41
41
  Supported algorithms:
42
42
  ```typescript
43
+ // Standard configuration
43
44
  import {
44
45
  slh_dsa_sha2_128f as sph,
45
46
  slh_dsa_sha2_128s,
@@ -54,9 +55,13 @@ import {
54
55
  slh_dsa_shake_256f,
55
56
  slh_dsa_shake_256s,
56
57
  } from 'slh-dsa';
58
+
59
+ // Special in this library
60
+ import { customSphincs } from 'slh-dsa'
61
+ const slh = customSphincs({ /* custom options */ }, /* hash function (sha256/sha512/shake) */)
57
62
  ```
58
63
 
59
- ### `generateKeys()`
64
+ ### `keygen()`
60
65
 
61
66
  Generates a new keypair.
62
67
  Returns:
@@ -64,10 +69,10 @@ Returns:
64
69
  ```typescript
65
70
  {
66
71
  publicKey: Uint8Array;
67
- privateKey: Uint8Array;
72
+ secretKey: Uint8Array;
68
73
  }
69
74
  ```
70
- ### `sign(privateKey, message)`
75
+ ### `sign(message, privateKey)`
71
76
 
72
77
  Signs a message using the private key.
73
78
  - `privateKey`: `Uint8Array` - The private key from `generateKeys()`
@@ -77,7 +82,7 @@ Signs a message using the private key.
77
82
 
78
83
  Returns: `Uint8Array` - The signature
79
84
 
80
- ### `verify(publicKey, message, signature)`
85
+ ### `verify(signature, message, publicKey)`
81
86
 
82
87
  Verifies a signature.
83
88
 
package/dist/index.d.ts CHANGED
@@ -60,3 +60,4 @@ export declare const slh_dsa_sha2_192s: SphincsSigner;
60
60
  export declare const slh_dsa_sha2_256f: SphincsSigner;
61
61
  /** SLH-DSA: 256-bit small SHA2 version. */
62
62
  export declare const slh_dsa_sha2_256s: SphincsSigner;
63
+ export declare const customSphincs: (opts: SphincsOpts, hash: "sha256" | "sha512" | "shake") => SphincsSigner;
package/dist/index.js CHANGED
@@ -623,3 +623,6 @@ export const slh_dsa_sha2_192s = /* @__PURE__ */ gen(PARAMS['192s'], SHA512_SIMP
623
623
  export const slh_dsa_sha2_256f = /* @__PURE__ */ gen(PARAMS['256f'], SHA512_SIMPLE);
624
624
  /** SLH-DSA: 256-bit small SHA2 version. */
625
625
  export const slh_dsa_sha2_256s = /* @__PURE__ */ gen(PARAMS['256s'], SHA512_SIMPLE);
626
+ export const customSphincs = (opts, hash) => {
627
+ return gen(opts, hash == 'sha256' ? SHA256_SIMPLE : hash == 'sha512' ? SHA512_SIMPLE : SHAKE_SIMPLE);
628
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slh-dsa",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "description": "Lightweight wrapper for SLH-DSA or SPHINCS+",
6
6
  "author": "Nbrthx",