aegis-aead 0.2.1 → 0.2.3
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 +29 -22
- package/dist/aegis128l.d.ts +33 -33
- package/dist/aegis128l.js +225 -235
- package/dist/aegis128x.d.ts +35 -35
- package/dist/aegis128x.js +348 -282
- package/dist/aegis256.d.ts +34 -51
- package/dist/aegis256.js +215 -206
- package/dist/aegis256x.d.ts +32 -33
- package/dist/aegis256x.js +333 -265
- package/dist/aes-bs.d.ts +46 -23
- package/dist/aes-bs.js +2273 -331
- package/dist/index.d.ts +4 -7
- package/dist/index.js +4 -7
- package/dist/random.d.ts +0 -1
- package/dist/random.js +0 -1
- package/dist/utils.d.ts +14 -0
- package/dist/utils.js +31 -0
- package/package.json +6 -6
- package/dist/aegis128l-bs.d.ts +0 -194
- package/dist/aegis128l-bs.d.ts.map +0 -1
- package/dist/aegis128l-bs.js +0 -549
- package/dist/aegis128l-bs.js.map +0 -1
- package/dist/aegis128l.d.ts.map +0 -1
- package/dist/aegis128l.js.map +0 -1
- package/dist/aegis128x.d.ts.map +0 -1
- package/dist/aegis128x.js.map +0 -1
- package/dist/aegis256-bs.d.ts +0 -183
- package/dist/aegis256-bs.d.ts.map +0 -1
- package/dist/aegis256-bs.js +0 -477
- package/dist/aegis256-bs.js.map +0 -1
- package/dist/aegis256.d.ts.map +0 -1
- package/dist/aegis256.js.map +0 -1
- package/dist/aegis256x.d.ts.map +0 -1
- package/dist/aegis256x.js.map +0 -1
- package/dist/aes-bs.d.ts.map +0 -1
- package/dist/aes-bs.js.map +0 -1
- package/dist/aes.d.ts +0 -81
- package/dist/aes.d.ts.map +0 -1
- package/dist/aes.js +0 -232
- package/dist/aes.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/random.d.ts.map +0 -1
- package/dist/random.js.map +0 -1
- package/src/aegis128l-bs.ts +0 -709
- package/src/aegis128l.ts +0 -653
- package/src/aegis128x.ts +0 -932
- package/src/aegis256-bs.ts +0 -625
- package/src/aegis256.ts +0 -597
- package/src/aegis256x.ts +0 -893
- package/src/aes-bs.ts +0 -459
- package/src/aes.ts +0 -271
- package/src/index.ts +0 -126
- package/src/random.ts +0 -41
- package/src/typed-array.d.ts +0 -18
package/dist/aes-bs.d.ts
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
* Bitsliced AES implementation using 32-bit integers.
|
|
3
3
|
* Processes 8 AES blocks simultaneously for constant-time operation.
|
|
4
4
|
* Based on the barrel-shiftrows representation by Adomnicai and Peyrin.
|
|
5
|
+
*
|
|
6
|
+
* The packed layout matches the reference C implementation: the state words
|
|
7
|
+
* are permuted so that bit-plane k of byte group g lives in word 4k + g.
|
|
8
|
+
* The four group lanes of each bit-plane are therefore adjacent, ShiftRows
|
|
9
|
+
* and MixColumns work on isomorphic quads, and an AES round needs no
|
|
10
|
+
* per-round transposes.
|
|
11
|
+
*
|
|
12
|
+
* The hot-path functions (AEGIS rounds, constant-input packing, keystream
|
|
13
|
+
* extraction) are fully unrolled over local variables and generated by
|
|
14
|
+
* scripts/gen-aes-bs.ts.
|
|
5
15
|
*/
|
|
6
16
|
/**
|
|
7
17
|
* Bitsliced representation of 8 AES blocks.
|
|
@@ -21,10 +31,11 @@ export declare function createAesBlocks(): AesBlocks;
|
|
|
21
31
|
*/
|
|
22
32
|
export declare function createAesBlock(): AesBlock;
|
|
23
33
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
34
|
+
* Computes the index of a block word in the unpacked state array.
|
|
35
|
+
* @param block - Block index (0-7)
|
|
36
|
+
* @param word - Word index (0-3)
|
|
26
37
|
*/
|
|
27
|
-
export declare function
|
|
38
|
+
export declare function wordIdx(block: number, word: number): number;
|
|
28
39
|
/**
|
|
29
40
|
* Pack 8 AES blocks into bitsliced representation.
|
|
30
41
|
*/
|
|
@@ -34,38 +45,50 @@ export declare function pack(st: AesBlocks): void;
|
|
|
34
45
|
*/
|
|
35
46
|
export declare function unpack(st: AesBlocks): void;
|
|
36
47
|
/**
|
|
37
|
-
*
|
|
48
|
+
* Put a single AES block into the unpacked state at the given block position.
|
|
38
49
|
*/
|
|
39
|
-
export declare function
|
|
50
|
+
export declare function blocksPut(st: AesBlocks, s: AesBlock, block: number): void;
|
|
40
51
|
/**
|
|
41
|
-
*
|
|
42
|
-
* @param block - Block index (0-7)
|
|
43
|
-
* @param word - Word index (0-3)
|
|
52
|
+
* Load 16 bytes at the given offset into an AES block (little-endian).
|
|
44
53
|
*/
|
|
45
|
-
export declare function
|
|
54
|
+
export declare function blockFromBytes(out: AesBlock, src: Uint8Array, off?: number): void;
|
|
55
|
+
/**
|
|
56
|
+
* Store an AES block as 16 bytes at the given offset (little-endian).
|
|
57
|
+
*/
|
|
58
|
+
export declare function blockToBytes(out: Uint8Array, src: AesBlock, off?: number): void;
|
|
46
59
|
/**
|
|
47
|
-
*
|
|
48
|
-
* Performs (st[i] & 0xfefefefe) >> 1 | (st[i] & 0x01010101) << 7
|
|
60
|
+
* XOR two AES blocks: out = a ^ b
|
|
49
61
|
*/
|
|
50
|
-
export declare function
|
|
62
|
+
export declare function blockXor(out: AesBlock, a: AesBlock, b: AesBlock): void;
|
|
51
63
|
/**
|
|
52
|
-
*
|
|
64
|
+
* Fused AEGIS-128L update round on the packed state:
|
|
65
|
+
* st = st ^ rotr8(AESRound(st)) ^ ci, where rotr8 rotates the 8 block lanes.
|
|
53
66
|
*/
|
|
54
|
-
export declare function
|
|
67
|
+
export declare function aegisRound128(st: AesBlocks, ci: AesBlocks): void;
|
|
55
68
|
/**
|
|
56
|
-
*
|
|
69
|
+
* Fused AEGIS-256 update round on the packed state:
|
|
70
|
+
* st = st ^ rotr6(AESRound(st)) ^ ci, where rotr6 rotates the 6 block lanes.
|
|
57
71
|
*/
|
|
58
|
-
export declare function
|
|
72
|
+
export declare function aegisRound256(st: AesBlocks, ci: AesBlocks): void;
|
|
59
73
|
/**
|
|
60
|
-
*
|
|
74
|
+
* Pack two message blocks (at positions 0 and 4) into a constant-input state
|
|
75
|
+
* for the AEGIS-128L round. Specialized pack04 exploiting the sparse input.
|
|
61
76
|
*/
|
|
62
|
-
export declare function
|
|
77
|
+
export declare function packConstantInput128(out: AesBlocks, m0: AesBlock, m1: AesBlock): void;
|
|
63
78
|
/**
|
|
64
|
-
*
|
|
79
|
+
* Pack one message block (at position 0) into a constant-input state for the
|
|
80
|
+
* AEGIS-256 round. Specialized pack04_6 exploiting the sparse input.
|
|
65
81
|
*/
|
|
66
|
-
export declare function
|
|
82
|
+
export declare function packConstantInput256(out: AesBlocks, m: AesBlock): void;
|
|
83
|
+
/**
|
|
84
|
+
* AEGIS-128L keystream extraction from the packed state:
|
|
85
|
+
* z0 = S6 ^ S1 ^ (S2 & S3), z1 = S2 ^ S5 ^ (S6 & S7), computed lane-wise,
|
|
86
|
+
* then unpacked (unpack04 restricted to the words feeding blocks 0 and 4).
|
|
87
|
+
*/
|
|
88
|
+
export declare function keystream128(st: AesBlocks, z0: AesBlock, z1: AesBlock): void;
|
|
67
89
|
/**
|
|
68
|
-
*
|
|
90
|
+
* AEGIS-256 keystream extraction from the packed state:
|
|
91
|
+
* z = S1 ^ S4 ^ S5 ^ (S2 & S3), computed lane-wise, then unpacked
|
|
92
|
+
* (unpack04_6 restricted to the words feeding block 0).
|
|
69
93
|
*/
|
|
70
|
-
export declare function
|
|
71
|
-
//# sourceMappingURL=aes-bs.d.ts.map
|
|
94
|
+
export declare function keystream256(st: AesBlocks, z: AesBlock): void;
|