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,43 +1,49 @@
1
+ /**
2
+ * AEGIS-256X implementation with configurable parallelism degree.
3
+ * Extends AEGIS-256 with parallel lanes for improved performance on wide
4
+ * SIMD architectures. Each lane is an independent AEGIS-256 state kept in
5
+ * packed bitsliced form, built on the constant-time bitsliced AES core.
6
+ */
1
7
  /**
2
8
  * AEGIS-256X cipher state with configurable parallelism degree.
3
- * Extends AEGIS-256 with parallel AES rounds for improved performance on wide SIMD architectures.
4
9
  */
5
10
  export declare class Aegis256XState {
6
- private v;
7
11
  private d;
8
- private rate;
9
- private newV;
12
+ private rateBytes;
13
+ private lanes;
14
+ private ci;
15
+ private ciZero;
10
16
  private tmp;
11
17
  private z;
12
- private ctxBufs;
13
18
  /**
14
19
  * Creates a new AEGIS-256X state.
15
20
  * @param degree - Parallelism degree (default: 2). Use 2 for AEGIS-256X2, 4 for AEGIS-256X4.
16
21
  */
17
22
  constructor(degree?: number);
23
+ /**
24
+ * Returns the state blocks as byte arrays indexed [block][lane] (for testing).
25
+ */
26
+ get v(): Uint8Array[][];
18
27
  /**
19
28
  * Initializes the state with a key and nonce.
20
29
  * @param key - 32-byte encryption key
21
30
  * @param nonce - 32-byte nonce (must be unique per message)
22
31
  */
23
32
  init(key: Uint8Array, nonce: Uint8Array): void;
24
- /**
25
- * Updates the state with a message vector.
26
- * @param m - Message vector (16*degree bytes)
27
- */
28
- update(m: Uint8Array): void;
29
33
  /**
30
34
  * Absorbs an associated data block into the state.
31
- * @param ai - Associated data block (16*degree bytes)
35
+ * @param ai - Buffer holding the 16*degree-byte associated data block
36
+ * @param off - Offset of the block within the buffer
32
37
  */
33
- absorb(ai: Uint8Array): void;
34
- private computeZ;
38
+ absorb(ai: Uint8Array, off?: number): void;
35
39
  /**
36
40
  * Encrypts a plaintext block and writes to output buffer.
37
- * @param xi - Plaintext block (16*degree bytes)
38
- * @param out - Output buffer (16*degree bytes)
41
+ * @param xi - Buffer holding the 16*degree-byte plaintext block
42
+ * @param out - Output buffer receiving the ciphertext block
43
+ * @param inOff - Offset of the plaintext block within xi
44
+ * @param outOff - Offset of the ciphertext block within out
39
45
  */
40
- encTo(xi: Uint8Array, out: Uint8Array): void;
46
+ encTo(xi: Uint8Array, out: Uint8Array, inOff?: number, outOff?: number): void;
41
47
  /**
42
48
  * Encrypts a plaintext block.
43
49
  * @param xi - Plaintext block (16*degree bytes)
@@ -46,25 +52,19 @@ export declare class Aegis256XState {
46
52
  enc(xi: Uint8Array): Uint8Array;
47
53
  /**
48
54
  * Decrypts a ciphertext block and writes to output buffer.
49
- * @param ci - Ciphertext block (16*degree bytes)
50
- * @param out - Output buffer (16*degree bytes)
55
+ * @param ci - Buffer holding the 16*degree-byte ciphertext block
56
+ * @param out - Output buffer receiving the plaintext block
57
+ * @param inOff - Offset of the ciphertext block within ci
58
+ * @param outOff - Offset of the plaintext block within out
51
59
  */
52
- decTo(ci: Uint8Array, out: Uint8Array): void;
60
+ decTo(ci: Uint8Array, out: Uint8Array, inOff?: number, outOff?: number): void;
53
61
  /**
54
62
  * Decrypts a ciphertext block.
55
63
  * @param ci - Ciphertext block (16*degree bytes)
56
64
  * @returns Plaintext block of the same size
57
65
  */
58
66
  dec(ci: Uint8Array): Uint8Array;
59
- /**
60
- * Encrypts a plaintext block in-place.
61
- * @param block - Buffer (plaintext in, ciphertext out), size 16*degree bytes
62
- */
63
67
  encInPlace(block: Uint8Array): void;
64
- /**
65
- * Decrypts a ciphertext block in-place.
66
- * @param block - Buffer (ciphertext in, plaintext out), size 16*degree bytes
67
- */
68
68
  decInPlace(block: Uint8Array): void;
69
69
  /**
70
70
  * Decrypts a partial (final) ciphertext block.
@@ -74,20 +74,20 @@ export declare class Aegis256XState {
74
74
  decPartial(cn: Uint8Array): Uint8Array;
75
75
  /**
76
76
  * Finalizes encryption/decryption and produces an authentication tag.
77
- * @param adLenBits - Associated data length in bits
78
- * @param msgLenBits - Message length in bits
77
+ * @param adLen - Associated data length in bytes
78
+ * @param msgLen - Message length in bytes
79
79
  * @param tagLen - Tag length (16 or 32 bytes)
80
80
  * @returns Authentication tag
81
81
  */
82
- finalize(adLenBits: bigint, msgLenBits: bigint, tagLen?: 16 | 32): Uint8Array;
82
+ finalize(adLen: number, msgLen: number, tagLen?: 16 | 32): Uint8Array;
83
83
  /**
84
84
  * Finalizes MAC computation and produces an authentication tag.
85
85
  * Uses a different finalization procedure than encryption/decryption.
86
- * @param dataLenBits - Data length in bits
86
+ * @param dataLen - Data length in bytes
87
87
  * @param tagLen - Tag length (16 or 32 bytes)
88
88
  * @returns Authentication tag
89
89
  */
90
- finalizeMac(dataLenBits: bigint, tagLen?: 16 | 32): Uint8Array;
90
+ finalizeMac(dataLen: number, tagLen?: 16 | 32): Uint8Array;
91
91
  }
92
92
  /**
93
93
  * Encrypts a message using AEGIS-256X (detached mode).
@@ -243,4 +243,3 @@ export declare const aegis256X2CreateNonce: typeof aegis256XCreateNonce;
243
243
  export declare const aegis256X4CreateKey: typeof aegis256XCreateKey;
244
244
  /** AEGIS-256X4 nonce generation (degree=4). */
245
245
  export declare const aegis256X4CreateNonce: typeof aegis256XCreateNonce;
246
- //# sourceMappingURL=aegis256x.d.ts.map