aegis-aead 0.2.2 → 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.
Files changed (55) hide show
  1. package/README.md +25 -20
  2. package/dist/aegis128l.d.ts +33 -33
  3. package/dist/aegis128l.js +225 -235
  4. package/dist/aegis128x.d.ts +35 -35
  5. package/dist/aegis128x.js +348 -282
  6. package/dist/aegis256.d.ts +34 -51
  7. package/dist/aegis256.js +215 -206
  8. package/dist/aegis256x.d.ts +32 -33
  9. package/dist/aegis256x.js +333 -265
  10. package/dist/aes-bs.d.ts +42 -35
  11. package/dist/aes-bs.js +2269 -401
  12. package/dist/index.d.ts +4 -7
  13. package/dist/index.js +4 -7
  14. package/dist/random.d.ts +0 -1
  15. package/dist/random.js +0 -1
  16. package/dist/utils.d.ts +14 -0
  17. package/dist/utils.js +31 -0
  18. package/package.json +5 -6
  19. package/dist/aegis128l-bs.d.ts +0 -137
  20. package/dist/aegis128l-bs.d.ts.map +0 -1
  21. package/dist/aegis128l-bs.js +0 -442
  22. package/dist/aegis128l-bs.js.map +0 -1
  23. package/dist/aegis128l.d.ts.map +0 -1
  24. package/dist/aegis128l.js.map +0 -1
  25. package/dist/aegis128x.d.ts.map +0 -1
  26. package/dist/aegis128x.js.map +0 -1
  27. package/dist/aegis256-bs.d.ts +0 -79
  28. package/dist/aegis256-bs.d.ts.map +0 -1
  29. package/dist/aegis256-bs.js +0 -366
  30. package/dist/aegis256-bs.js.map +0 -1
  31. package/dist/aegis256.d.ts.map +0 -1
  32. package/dist/aegis256.js.map +0 -1
  33. package/dist/aegis256x.d.ts.map +0 -1
  34. package/dist/aegis256x.js.map +0 -1
  35. package/dist/aes-bs.d.ts.map +0 -1
  36. package/dist/aes-bs.js.map +0 -1
  37. package/dist/aes.d.ts +0 -81
  38. package/dist/aes.d.ts.map +0 -1
  39. package/dist/aes.js +0 -232
  40. package/dist/aes.js.map +0 -1
  41. package/dist/index.d.ts.map +0 -1
  42. package/dist/index.js.map +0 -1
  43. package/dist/random.d.ts.map +0 -1
  44. package/dist/random.js.map +0 -1
  45. package/src/aegis128l-bs.ts +0 -600
  46. package/src/aegis128l.ts +0 -653
  47. package/src/aegis128x.ts +0 -932
  48. package/src/aegis256-bs.ts +0 -519
  49. package/src/aegis256.ts +0 -597
  50. package/src/aegis256x.ts +0 -893
  51. package/src/aes-bs.ts +0 -540
  52. package/src/aes.ts +0 -271
  53. package/src/index.ts +0 -126
  54. package/src/random.ts +0 -41
  55. package/src/typed-array.d.ts +0 -18
@@ -1,45 +1,52 @@
1
+ /**
2
+ * AEGIS-128X implementation with configurable parallelism degree.
3
+ * Extends AEGIS-128L with parallel lanes for improved performance on wide
4
+ * SIMD architectures. Each lane is an independent AEGIS-128L state kept in
5
+ * packed bitsliced form, built on the constant-time bitsliced AES core.
6
+ */
1
7
  /**
2
8
  * AEGIS-128X cipher state with configurable parallelism degree.
3
- * Extends AEGIS-128L with parallel AES rounds for improved performance on wide SIMD architectures.
4
9
  */
5
10
  export declare class Aegis128XState {
6
- private v;
7
11
  private d;
8
- private rate;
9
- private newV;
10
- private tmp;
12
+ private halfRate;
13
+ private rateBytes;
14
+ private lanes;
15
+ private ci;
16
+ private ciZero;
17
+ private tmp0;
18
+ private tmp1;
11
19
  private z0;
12
20
  private z1;
13
- private ctxBufs;
14
21
  /**
15
22
  * Creates a new AEGIS-128X state.
16
23
  * @param degree - Parallelism degree (default: 2). Use 2 for AEGIS-128X2, 4 for AEGIS-128X4.
17
24
  */
18
25
  constructor(degree?: number);
26
+ /**
27
+ * Returns the state blocks as byte arrays indexed [block][lane] (for testing).
28
+ */
29
+ get v(): Uint8Array[][];
19
30
  /**
20
31
  * Initializes the state with a key and nonce.
21
32
  * @param key - 16-byte encryption key
22
33
  * @param nonce - 16-byte nonce (must be unique per message)
23
34
  */
24
35
  init(key: Uint8Array, nonce: Uint8Array): void;
25
- /**
26
- * Updates the state with two message vectors.
27
- * @param m0 - First message vector (16*degree bytes)
28
- * @param m1 - Second message vector (16*degree bytes)
29
- */
30
- update(m0: Uint8Array, m1: Uint8Array): void;
31
36
  /**
32
37
  * Absorbs an associated data block into the state.
33
- * @param ai - Associated data block (32*degree bytes)
38
+ * @param ai - Buffer holding the 32*degree-byte associated data block
39
+ * @param off - Offset of the block within the buffer
34
40
  */
35
- absorb(ai: Uint8Array): void;
36
- private computeZ;
41
+ absorb(ai: Uint8Array, off?: number): void;
37
42
  /**
38
43
  * Encrypts a plaintext block and writes to output buffer.
39
- * @param xi - Plaintext block (32*degree bytes)
40
- * @param out - Output buffer (32*degree bytes)
44
+ * @param xi - Buffer holding the 32*degree-byte plaintext block
45
+ * @param out - Output buffer receiving the ciphertext block
46
+ * @param inOff - Offset of the plaintext block within xi
47
+ * @param outOff - Offset of the ciphertext block within out
41
48
  */
42
- encTo(xi: Uint8Array, out: Uint8Array): void;
49
+ encTo(xi: Uint8Array, out: Uint8Array, inOff?: number, outOff?: number): void;
43
50
  /**
44
51
  * Encrypts a plaintext block.
45
52
  * @param xi - Plaintext block (32*degree bytes)
@@ -48,25 +55,19 @@ export declare class Aegis128XState {
48
55
  enc(xi: Uint8Array): Uint8Array;
49
56
  /**
50
57
  * Decrypts a ciphertext block and writes to output buffer.
51
- * @param ci - Ciphertext block (32*degree bytes)
52
- * @param out - Output buffer (32*degree bytes)
58
+ * @param ci - Buffer holding the 32*degree-byte ciphertext block
59
+ * @param out - Output buffer receiving the plaintext block
60
+ * @param inOff - Offset of the ciphertext block within ci
61
+ * @param outOff - Offset of the plaintext block within out
53
62
  */
54
- decTo(ci: Uint8Array, out: Uint8Array): void;
63
+ decTo(ci: Uint8Array, out: Uint8Array, inOff?: number, outOff?: number): void;
55
64
  /**
56
65
  * Decrypts a ciphertext block.
57
66
  * @param ci - Ciphertext block (32*degree bytes)
58
67
  * @returns Plaintext block of the same size
59
68
  */
60
69
  dec(ci: Uint8Array): Uint8Array;
61
- /**
62
- * Encrypts a plaintext block in-place.
63
- * @param block - Buffer (plaintext in, ciphertext out), size 32*degree bytes
64
- */
65
70
  encInPlace(block: Uint8Array): void;
66
- /**
67
- * Decrypts a ciphertext block in-place.
68
- * @param block - Buffer (ciphertext in, plaintext out), size 32*degree bytes
69
- */
70
71
  decInPlace(block: Uint8Array): void;
71
72
  /**
72
73
  * Decrypts a partial (final) ciphertext block.
@@ -76,20 +77,20 @@ export declare class Aegis128XState {
76
77
  decPartial(cn: Uint8Array): Uint8Array;
77
78
  /**
78
79
  * Finalizes encryption/decryption and produces an authentication tag.
79
- * @param adLenBits - Associated data length in bits
80
- * @param msgLenBits - Message length in bits
80
+ * @param adLen - Associated data length in bytes
81
+ * @param msgLen - Message length in bytes
81
82
  * @param tagLen - Tag length (16 or 32 bytes)
82
83
  * @returns Authentication tag
83
84
  */
84
- finalize(adLenBits: bigint, msgLenBits: bigint, tagLen?: 16 | 32): Uint8Array;
85
+ finalize(adLen: number, msgLen: number, tagLen?: 16 | 32): Uint8Array;
85
86
  /**
86
87
  * Finalizes MAC computation and produces an authentication tag.
87
88
  * Uses a different finalization procedure than encryption/decryption.
88
- * @param dataLenBits - Data length in bits
89
+ * @param dataLen - Data length in bytes
89
90
  * @param tagLen - Tag length (16 or 32 bytes)
90
91
  * @returns Authentication tag
91
92
  */
92
- finalizeMac(dataLenBits: bigint, tagLen?: 16 | 32): Uint8Array;
93
+ finalizeMac(dataLen: number, tagLen?: 16 | 32): Uint8Array;
93
94
  }
94
95
  /**
95
96
  * Encrypts a message using AEGIS-128X (detached mode).
@@ -245,4 +246,3 @@ export declare const aegis128X2CreateNonce: typeof aegis128XCreateNonce;
245
246
  export declare const aegis128X4CreateKey: typeof aegis128XCreateKey;
246
247
  /** AEGIS-128X4 nonce generation (degree=4). */
247
248
  export declare const aegis128X4CreateNonce: typeof aegis128XCreateNonce;
248
- //# sourceMappingURL=aegis128x.d.ts.map