@lib-q/hash 0.0.2 → 0.0.6

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,97 +1,97 @@
1
- # lib-q-hash
2
-
3
- Post-quantum hash functions for lib-Q.
4
-
5
- ## Features
6
-
7
- - **SHA-3**: SHA3-224, SHA3-256, SHA3-384, SHA3-512
8
- - **SHAKE**: SHAKE128, SHAKE256
9
- - **cSHAKE**: Customizable SHAKE functions
10
- - **TurboSHAKE**: Accelerated SHAKE variant
11
- - **KangarooTwelve**: Fast hash function based on Keccak
12
- - **KMAC**: Keyed Message Authentication Code (128/256)
13
- - **TupleHash**: Tuple-based hashing (128/256)
14
- - **ParallelHash**: Parallel processing for large data (128/256)
15
-
16
- ## WebAssembly
17
-
18
- The `parallelhash` feature enables Rayon and **must not** be used on `wasm32-unknown-unknown`; the crate fails to compile with that feature on WASM. Use serial builds for browser targets.
19
-
20
- ## Usage
21
-
22
- ### Basic Hashing
23
-
24
- ```rust
25
- use lib_q_hash::{Sha3_256, Digest};
26
-
27
- let mut hasher = Sha3_256::new();
28
- hasher.update(b"Hello, world!");
29
- let result = hasher.finalize();
30
- ```
31
-
32
- ### KMAC
33
-
34
- ```rust
35
- use lib_q_hash::{Kmac128, digest::{Update, ExtendableOutput}};
36
-
37
- let mut kmac = Kmac128::new(b"key", b"custom");
38
- kmac.update(b"message");
39
- let mut output = [0u8; 32];
40
- kmac.finalize(&mut output);
41
- ```
42
-
43
- ### TupleHash
44
-
45
- ```rust
46
- use lib_q_hash::{TupleHash128, digest::{Update, ExtendableOutput}};
47
-
48
- let mut tuplehash = TupleHash128::new(b"custom");
49
- let tuple = vec![b"first", b"second"];
50
- tuplehash.update_tuple(&tuple);
51
- let mut output = [0u8; 32];
52
- tuplehash.finalize(&mut output);
53
- ```
54
-
55
- ### ParallelHash
56
-
57
- ```rust
58
- use lib_q_hash::{ParallelHash128, digest::{Update, ExtendableOutput}};
59
-
60
- let mut parallelhash = ParallelHash128::new(b"custom", 8192);
61
- parallelhash.update(b"large data");
62
- let mut output = [0u8; 32];
63
- parallelhash.finalize(&mut output);
64
- ```
65
-
66
- ### State Serialization
67
-
68
- ```rust
69
- use lib_q_hash::{Kmac128, digest::SerializableState};
70
-
71
- let mut kmac = Kmac128::new(b"key", b"custom");
72
- kmac.update(b"partial data");
73
- let serialized = kmac.serialize();
74
-
75
- let mut kmac2 = Kmac128::deserialize(&serialized).unwrap();
76
- kmac2.update(b"more data");
77
- ```
78
-
79
- ## Features
80
-
81
- - `default` - Enables alloc and OID support
82
- - `alloc` - Heap allocation for dynamic output sizes
83
- - `oid` - Object Identifier support for ASN.1
84
- - `zeroize` - Secure memory wiping
85
- - `parallelhash` - Rayon-based parallel processing
86
- - `asm` - ARMv8 assembly optimizations
87
-
88
- ## Workspace
89
-
90
- [`lib-q-sha3`](../lib-q-sha3), [`lib-q-keccak`](../lib-q-keccak), and [`lib-q-k12`](../lib-q-k12) supply the Keccak/SHA-3 family implementations this crate integrates (see also [`lib-q-keccak-digest`](../lib-q-keccak-digest)). ML-DSA and lattice crates consume the same XOF stack via those dependencies. Index: [repository README](../README.md).
91
-
92
- ## License
93
-
94
- Apache-2.0
1
+ # lib-q-hash
2
+
3
+ Post-quantum hash functions for lib-Q.
4
+
5
+ ## Features
6
+
7
+ - **SHA-3**: SHA3-224, SHA3-256, SHA3-384, SHA3-512
8
+ - **SHAKE**: SHAKE128, SHAKE256
9
+ - **cSHAKE**: Customizable SHAKE functions
10
+ - **TurboSHAKE**: Accelerated SHAKE variant
11
+ - **KangarooTwelve**: Fast hash function based on Keccak
12
+ - **KMAC**: Keyed Message Authentication Code (128/256)
13
+ - **TupleHash**: Tuple-based hashing (128/256)
14
+ - **ParallelHash**: Parallel processing for large data (128/256)
15
+
16
+ ## WebAssembly
17
+
18
+ The `parallelhash` feature enables Rayon and **must not** be used on `wasm32-unknown-unknown`; the crate fails to compile with that feature on WASM. Use serial builds for browser targets.
19
+
20
+ ## Usage
21
+
22
+ ### Basic Hashing
23
+
24
+ ```rust
25
+ use lib_q_hash::{Sha3_256, Digest};
26
+
27
+ let mut hasher = Sha3_256::new();
28
+ hasher.update(b"Hello, world!");
29
+ let result = hasher.finalize();
30
+ ```
31
+
32
+ ### KMAC
33
+
34
+ ```rust
35
+ use lib_q_hash::{Kmac128, digest::{Update, ExtendableOutput}};
36
+
37
+ let mut kmac = Kmac128::new(b"key", b"custom");
38
+ kmac.update(b"message");
39
+ let mut output = [0u8; 32];
40
+ kmac.finalize(&mut output);
41
+ ```
42
+
43
+ ### TupleHash
44
+
45
+ ```rust
46
+ use lib_q_hash::{TupleHash128, digest::{Update, ExtendableOutput}};
47
+
48
+ let mut tuplehash = TupleHash128::new(b"custom");
49
+ let tuple = vec![b"first", b"second"];
50
+ tuplehash.update_tuple(&tuple);
51
+ let mut output = [0u8; 32];
52
+ tuplehash.finalize(&mut output);
53
+ ```
54
+
55
+ ### ParallelHash
56
+
57
+ ```rust
58
+ use lib_q_hash::{ParallelHash128, digest::{Update, ExtendableOutput}};
59
+
60
+ let mut parallelhash = ParallelHash128::new(b"custom", 8192);
61
+ parallelhash.update(b"large data");
62
+ let mut output = [0u8; 32];
63
+ parallelhash.finalize(&mut output);
64
+ ```
65
+
66
+ ### State Serialization
67
+
68
+ ```rust
69
+ use lib_q_hash::{Kmac128, digest::SerializableState};
70
+
71
+ let mut kmac = Kmac128::new(b"key", b"custom");
72
+ kmac.update(b"partial data");
73
+ let serialized = kmac.serialize();
74
+
75
+ let mut kmac2 = Kmac128::deserialize(&serialized).unwrap();
76
+ kmac2.update(b"more data");
77
+ ```
78
+
79
+ ## Features
80
+
81
+ - `default` - Enables alloc and OID support
82
+ - `alloc` - Heap allocation for dynamic output sizes
83
+ - `oid` - Object Identifier support for ASN.1
84
+ - `zeroize` - Secure memory wiping
85
+ - `parallelhash` - Rayon-based parallel processing
86
+ - `asm` - ARMv8 assembly optimizations
87
+
88
+ ## Workspace
89
+
90
+ [`lib-q-sha3`](../lib-q-sha3), [`lib-q-keccak`](../lib-q-keccak), and [`lib-q-k12`](../lib-q-k12) supply the Keccak/SHA-3 family implementations this crate integrates (see also [`lib-q-keccak-digest`](../lib-q-keccak-digest)). ML-DSA and lattice crates consume the same XOF stack via those dependencies. Index: [repository README](../README.md).
91
+
92
+ ## License
93
+
94
+ Apache-2.0
95
95
 
96
96
  ## Subresource integrity (SHA-384)
97
- Paths in `integrity-manifest.json` are relative to the package root.
97
+ Paths in `integrity-manifest.json` are relative to the package root (including `web/` and `nodejs/` when both ship).
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "integrity": {
3
- "nodejs/lib_q_hash_bg.wasm": "sha384-EXVcJ18NnAf7oovB/muqXssBsAGJcfuRp2AKZ/Ytr6duc249aOfVO+OFrksTHpwy",
4
- "web/lib_q_hash_bg.wasm": "sha384-EXVcJ18NnAf7oovB/muqXssBsAGJcfuRp2AKZ/Ytr6duc249aOfVO+OFrksTHpwy"
3
+ "nodejs/lib_q_hash_bg.wasm": "sha384-j4yUSZaxEC6S3z4gaXS+y7zWX4niFhf5cyJhFz7JZK69B079eb6zCEPcMAgogL2Y",
4
+ "web/lib_q_hash_bg.wasm": "sha384-j4yUSZaxEC6S3z4gaXS+y7zWX4niFhf5cyJhFz7JZK69B079eb6zCEPcMAgogL2Y"
5
5
  }
6
6
  }