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.
Files changed (55) hide show
  1. package/README.md +29 -22
  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 +46 -23
  11. package/dist/aes-bs.js +2273 -331
  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 +6 -6
  19. package/dist/aegis128l-bs.d.ts +0 -194
  20. package/dist/aegis128l-bs.d.ts.map +0 -1
  21. package/dist/aegis128l-bs.js +0 -549
  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 -183
  28. package/dist/aegis256-bs.d.ts.map +0 -1
  29. package/dist/aegis256-bs.js +0 -477
  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 -709
  46. package/src/aegis128l.ts +0 -653
  47. package/src/aegis128x.ts +0 -932
  48. package/src/aegis256-bs.ts +0 -625
  49. package/src/aegis256.ts +0 -597
  50. package/src/aegis256x.ts +0 -893
  51. package/src/aes-bs.ts +0 -459
  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,21 +1,27 @@
1
+ /**
2
+ * AEGIS-256 implementation.
3
+ * Built on the constant-time bitsliced AES core, which processes the state
4
+ * blocks simultaneously without lookup tables.
5
+ */
1
6
  /**
2
7
  * AEGIS-256 cipher state.
3
- * Uses 6 AES blocks (96 bytes) of internal state and processes 16-byte blocks.
8
+ * Uses 6 AES blocks stored in packed bitsliced form throughout the lifetime
9
+ * of the state.
4
10
  */
5
11
  export declare class Aegis256State {
6
- private s0;
7
- private s1;
8
- private s2;
9
- private s3;
10
- private s4;
11
- private s5;
12
+ private st;
13
+ private constantInput;
12
14
  private tmp;
13
15
  private z;
14
- private newS;
15
- private tBuf;
16
16
  constructor();
17
+ /**
18
+ * Returns the 6 state blocks as byte arrays (for testing).
19
+ */
17
20
  get s(): Uint8Array[];
18
- set s(states: Uint8Array[]);
21
+ /**
22
+ * Sets the 6 state blocks from byte arrays (for testing).
23
+ */
24
+ set s(blocks: Uint8Array[]);
19
25
  /**
20
26
  * Initializes the state with a key and nonce.
21
27
  * @param key - 32-byte encryption key
@@ -24,62 +30,40 @@ export declare class Aegis256State {
24
30
  init(key: Uint8Array, nonce: Uint8Array): void;
25
31
  /**
26
32
  * Updates the state with a 16-byte message block.
27
- * @param m - ArrayLike<number> - 16-byte message block
33
+ * @param m - 16-byte message block
28
34
  */
29
- update(m: ArrayLike<number>): void;
35
+ update(m: Uint8Array): void;
30
36
  /**
31
37
  * Absorbs a 16-byte associated data block into the state.
32
- * @param ai - 16-byte associated data block
33
- */
34
- absorb(ai: Uint8Array): void;
35
- /**
36
- * Encrypts a 16-byte plaintext block and writes to output.
37
- * @param xi - 16-byte plaintext block
38
- * @param out - 16-byte output buffer
38
+ * @param ai - Buffer holding the 16-byte associated data block
39
+ * @param off - Offset of the block within the buffer
39
40
  */
40
- encTo(xi: Uint8Array, out: Uint8Array): void;
41
+ absorb(ai: Uint8Array, off?: number): void;
41
42
  /**
42
- * Encrypts a 16-byte plaintext block.
43
- * @param xi - 16-byte plaintext block
44
- * @returns 16-byte ciphertext block
43
+ * Encrypts a 16-byte plaintext block and writes to output buffer.
44
+ * @param xi - Buffer holding the 16-byte plaintext block
45
+ * @param out - Output buffer receiving the 16-byte ciphertext block
46
+ * @param inOff - Offset of the plaintext block within xi
47
+ * @param outOff - Offset of the ciphertext block within out
45
48
  */
49
+ encTo(xi: Uint8Array, out: Uint8Array, inOff?: number, outOff?: number): void;
46
50
  enc(xi: Uint8Array): Uint8Array;
47
51
  /**
48
- * Decrypts a 16-byte ciphertext block and writes to output.
49
- * @param ci - 16-byte ciphertext block
50
- * @param out - 16-byte output buffer
51
- */
52
- decTo(ci: Uint8Array, out: Uint8Array): void;
53
- /**
54
- * Decrypts a 16-byte ciphertext block.
55
- * @param ci - 16-byte ciphertext block
56
- * @returns 16-byte plaintext block
52
+ * Decrypts a 16-byte ciphertext block and writes to output buffer.
53
+ * @param ci - Buffer holding the 16-byte ciphertext block
54
+ * @param out - Output buffer receiving the 16-byte plaintext block
55
+ * @param inOff - Offset of the ciphertext block within ci
56
+ * @param outOff - Offset of the plaintext block within out
57
57
  */
58
+ decTo(ci: Uint8Array, out: Uint8Array, inOff?: number, outOff?: number): void;
58
59
  dec(ci: Uint8Array): Uint8Array;
59
- /**
60
- * Encrypts a 16-byte plaintext block in-place.
61
- * @param block - 16-byte buffer (plaintext in, ciphertext out)
62
- */
63
60
  encInPlace(block: Uint8Array): void;
64
- /**
65
- * Decrypts a 16-byte ciphertext block in-place.
66
- * @param block - 16-byte buffer (ciphertext in, plaintext out)
67
- */
68
61
  decInPlace(block: Uint8Array): void;
69
- /**
70
- * Decrypts a partial (final) ciphertext block smaller than 16 bytes.
71
- * @param cn - Partial ciphertext block (1-15 bytes)
72
- * @returns Decrypted plaintext of the same length
73
- */
74
62
  decPartial(cn: Uint8Array): Uint8Array;
75
63
  /**
76
64
  * Finalizes encryption/decryption and produces an authentication tag.
77
- * @param adLenBits - Associated data length in bits
78
- * @param msgLenBits - Message length in bits
79
- * @param tagLen - Tag length (16 or 32 bytes)
80
- * @returns Authentication tag
81
65
  */
82
- finalize(adLenBits: bigint, msgLenBits: bigint, tagLen?: 16 | 32): Uint8Array;
66
+ finalize(adLen: number, msgLen: number, tagLen?: 16 | 32): Uint8Array;
83
67
  }
84
68
  /**
85
69
  * Encrypts a message using AEGIS-256 (detached mode).
@@ -181,4 +165,3 @@ export declare function aegis256CreateKey(): Uint8Array;
181
165
  * @throws Error if no cryptographic random source is available
182
166
  */
183
167
  export declare function aegis256CreateNonce(): Uint8Array;
184
- //# sourceMappingURL=aegis256.d.ts.map