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/index.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
export { AEGIS_128L_KEY_SIZE, AEGIS_128L_NONCE_SIZE, aegis128LCreateKey, aegis128LCreateNonce, aegis128LDecrypt, aegis128LDecryptDetached, aegis128LDecryptDetachedInPlace, aegis128LEncrypt, aegis128LEncryptDetached, aegis128LEncryptDetachedInPlace, aegis128LMac, aegis128LMacVerify, } from "./aegis128l.js";
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export { AEGIS_256_BS_KEY_SIZE, AEGIS_256_BS_NONCE_SIZE, Aegis256BsState, aegis256BsCreateKey, aegis256BsCreateNonce, aegis256BsDecrypt, aegis256BsDecryptDetached, aegis256BsDecryptDetachedInPlace, aegis256BsEncrypt, aegis256BsEncryptDetached, aegis256BsEncryptDetachedInPlace, aegis256BsMac, aegis256BsMacVerify, } from "./aegis256-bs.js";
|
|
6
|
-
export { AEGIS_256X_KEY_SIZE, AEGIS_256X_NONCE_SIZE, aegis256X2CreateKey, aegis256X2CreateNonce, aegis256X2Decrypt, aegis256X2DecryptDetached, aegis256X2DecryptDetachedInPlace, aegis256X2Encrypt, aegis256X2EncryptDetached, aegis256X2EncryptDetachedInPlace, aegis256X2Mac, aegis256X2MacVerify, aegis256X4CreateKey, aegis256X4CreateNonce, aegis256X4Decrypt, aegis256X4DecryptDetached, aegis256X4DecryptDetachedInPlace, aegis256X4Encrypt, aegis256X4EncryptDetached, aegis256X4EncryptDetachedInPlace, aegis256X4Mac, aegis256X4MacVerify, aegis256XCreateKey, aegis256XCreateNonce, aegis256XDecrypt, aegis256XDecryptDetached, aegis256XDecryptDetachedInPlace, aegis256XEncrypt, aegis256XEncryptDetached, aegis256XEncryptDetachedInPlace, aegis256XMac, aegis256XMacVerify, } from "./aegis256x.js";
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export { AEGIS_128L_KEY_SIZE, AEGIS_128L_NONCE_SIZE, Aegis128LState, aegis128LCreateKey, aegis128LCreateNonce, aegis128LDecrypt, aegis128LDecryptDetached, aegis128LDecryptDetachedInPlace, aegis128LEncrypt, aegis128LEncryptDetached, aegis128LEncryptDetachedInPlace, aegis128LMac, aegis128LMacVerify, } from "./aegis128l.js";
|
|
2
|
+
export { AEGIS_128X_KEY_SIZE, AEGIS_128X_NONCE_SIZE, Aegis128XState, aegis128X2CreateKey, aegis128X2CreateNonce, aegis128X2Decrypt, aegis128X2DecryptDetached, aegis128X2DecryptDetachedInPlace, aegis128X2Encrypt, aegis128X2EncryptDetached, aegis128X2EncryptDetachedInPlace, aegis128X2Mac, aegis128X2MacVerify, aegis128X4CreateKey, aegis128X4CreateNonce, aegis128X4Decrypt, aegis128X4DecryptDetached, aegis128X4DecryptDetachedInPlace, aegis128X4Encrypt, aegis128X4EncryptDetached, aegis128X4EncryptDetachedInPlace, aegis128X4Mac, aegis128X4MacVerify, aegis128XCreateKey, aegis128XCreateNonce, aegis128XDecrypt, aegis128XDecryptDetached, aegis128XDecryptDetachedInPlace, aegis128XEncrypt, aegis128XEncryptDetached, aegis128XEncryptDetachedInPlace, aegis128XMac, aegis128XMacVerify, } from "./aegis128x.js";
|
|
3
|
+
export { AEGIS_256_KEY_SIZE, AEGIS_256_NONCE_SIZE, Aegis256State, aegis256CreateKey, aegis256CreateNonce, aegis256Decrypt, aegis256DecryptDetached, aegis256DecryptDetachedInPlace, aegis256Encrypt, aegis256EncryptDetached, aegis256EncryptDetachedInPlace, aegis256Mac, aegis256MacVerify, } from "./aegis256.js";
|
|
4
|
+
export { AEGIS_256X_KEY_SIZE, AEGIS_256X_NONCE_SIZE, Aegis256XState, aegis256X2CreateKey, aegis256X2CreateNonce, aegis256X2Decrypt, aegis256X2DecryptDetached, aegis256X2DecryptDetachedInPlace, aegis256X2Encrypt, aegis256X2EncryptDetached, aegis256X2EncryptDetachedInPlace, aegis256X2Mac, aegis256X2MacVerify, aegis256X4CreateKey, aegis256X4CreateNonce, aegis256X4Decrypt, aegis256X4DecryptDetached, aegis256X4DecryptDetachedInPlace, aegis256X4Encrypt, aegis256X4EncryptDetached, aegis256X4EncryptDetachedInPlace, aegis256X4Mac, aegis256X4MacVerify, aegis256XCreateKey, aegis256XCreateNonce, aegis256XDecrypt, aegis256XDecryptDetached, aegis256XDecryptDetachedInPlace, aegis256XEncrypt, aegis256XEncryptDetached, aegis256XEncryptDetachedInPlace, aegis256XMac, aegis256XMacVerify, } from "./aegis256x.js";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
export { AEGIS_128L_KEY_SIZE, AEGIS_128L_NONCE_SIZE, aegis128LCreateKey, aegis128LCreateNonce, aegis128LDecrypt, aegis128LDecryptDetached, aegis128LDecryptDetachedInPlace, aegis128LEncrypt, aegis128LEncryptDetached, aegis128LEncryptDetachedInPlace, aegis128LMac, aegis128LMacVerify, } from "./aegis128l.js";
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export { AEGIS_256_BS_KEY_SIZE, AEGIS_256_BS_NONCE_SIZE, Aegis256BsState, aegis256BsCreateKey, aegis256BsCreateNonce, aegis256BsDecrypt, aegis256BsDecryptDetached, aegis256BsDecryptDetachedInPlace, aegis256BsEncrypt, aegis256BsEncryptDetached, aegis256BsEncryptDetachedInPlace, aegis256BsMac, aegis256BsMacVerify, } from "./aegis256-bs.js";
|
|
6
|
-
export { AEGIS_256X_KEY_SIZE, AEGIS_256X_NONCE_SIZE, aegis256X2CreateKey, aegis256X2CreateNonce, aegis256X2Decrypt, aegis256X2DecryptDetached, aegis256X2DecryptDetachedInPlace, aegis256X2Encrypt, aegis256X2EncryptDetached, aegis256X2EncryptDetachedInPlace, aegis256X2Mac, aegis256X2MacVerify, aegis256X4CreateKey, aegis256X4CreateNonce, aegis256X4Decrypt, aegis256X4DecryptDetached, aegis256X4DecryptDetachedInPlace, aegis256X4Encrypt, aegis256X4EncryptDetached, aegis256X4EncryptDetachedInPlace, aegis256X4Mac, aegis256X4MacVerify, aegis256XCreateKey, aegis256XCreateNonce, aegis256XDecrypt, aegis256XDecryptDetached, aegis256XDecryptDetachedInPlace, aegis256XEncrypt, aegis256XEncryptDetached, aegis256XEncryptDetachedInPlace, aegis256XMac, aegis256XMacVerify, } from "./aegis256x.js";
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { AEGIS_128L_KEY_SIZE, AEGIS_128L_NONCE_SIZE, Aegis128LState, aegis128LCreateKey, aegis128LCreateNonce, aegis128LDecrypt, aegis128LDecryptDetached, aegis128LDecryptDetachedInPlace, aegis128LEncrypt, aegis128LEncryptDetached, aegis128LEncryptDetachedInPlace, aegis128LMac, aegis128LMacVerify, } from "./aegis128l.js";
|
|
2
|
+
export { AEGIS_128X_KEY_SIZE, AEGIS_128X_NONCE_SIZE, Aegis128XState, aegis128X2CreateKey, aegis128X2CreateNonce, aegis128X2Decrypt, aegis128X2DecryptDetached, aegis128X2DecryptDetachedInPlace, aegis128X2Encrypt, aegis128X2EncryptDetached, aegis128X2EncryptDetachedInPlace, aegis128X2Mac, aegis128X2MacVerify, aegis128X4CreateKey, aegis128X4CreateNonce, aegis128X4Decrypt, aegis128X4DecryptDetached, aegis128X4DecryptDetachedInPlace, aegis128X4Encrypt, aegis128X4EncryptDetached, aegis128X4EncryptDetachedInPlace, aegis128X4Mac, aegis128X4MacVerify, aegis128XCreateKey, aegis128XCreateNonce, aegis128XDecrypt, aegis128XDecryptDetached, aegis128XDecryptDetachedInPlace, aegis128XEncrypt, aegis128XEncryptDetached, aegis128XEncryptDetachedInPlace, aegis128XMac, aegis128XMacVerify, } from "./aegis128x.js";
|
|
3
|
+
export { AEGIS_256_KEY_SIZE, AEGIS_256_NONCE_SIZE, Aegis256State, aegis256CreateKey, aegis256CreateNonce, aegis256Decrypt, aegis256DecryptDetached, aegis256DecryptDetachedInPlace, aegis256Encrypt, aegis256EncryptDetached, aegis256EncryptDetachedInPlace, aegis256Mac, aegis256MacVerify, } from "./aegis256.js";
|
|
4
|
+
export { AEGIS_256X_KEY_SIZE, AEGIS_256X_NONCE_SIZE, Aegis256XState, aegis256X2CreateKey, aegis256X2CreateNonce, aegis256X2Decrypt, aegis256X2DecryptDetached, aegis256X2DecryptDetachedInPlace, aegis256X2Encrypt, aegis256X2EncryptDetached, aegis256X2EncryptDetachedInPlace, aegis256X2Mac, aegis256X2MacVerify, aegis256X4CreateKey, aegis256X4CreateNonce, aegis256X4Decrypt, aegis256X4DecryptDetached, aegis256X4DecryptDetachedInPlace, aegis256X4Encrypt, aegis256X4EncryptDetached, aegis256X4EncryptDetachedInPlace, aegis256X4Mac, aegis256X4MacVerify, aegis256XCreateKey, aegis256XCreateNonce, aegis256XDecrypt, aegis256XDecryptDetached, aegis256XDecryptDetachedInPlace, aegis256XEncrypt, aegis256XEncryptDetached, aegis256XEncryptDetachedInPlace, aegis256XMac, aegis256XMacVerify, } from "./aegis256x.js";
|
package/dist/random.d.ts
CHANGED
package/dist/random.js
CHANGED
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pads data with zeros to a multiple of the block size.
|
|
3
|
+
* @param data - Input data
|
|
4
|
+
* @param blockSizeBytes - Block size in bytes
|
|
5
|
+
* @returns Padded data (or empty array if data is empty)
|
|
6
|
+
*/
|
|
7
|
+
export declare function zeroPad(data: ArrayLike<number>, blockSizeBytes: number): Uint8Array;
|
|
8
|
+
/**
|
|
9
|
+
* Compares two byte arrays in constant time to prevent timing attacks.
|
|
10
|
+
* @param a - First byte array
|
|
11
|
+
* @param b - Second byte array
|
|
12
|
+
* @returns True if arrays are equal, false otherwise
|
|
13
|
+
*/
|
|
14
|
+
export declare function constantTimeEqual(a: ArrayLike<number>, b: ArrayLike<number>): boolean;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pads data with zeros to a multiple of the block size.
|
|
3
|
+
* @param data - Input data
|
|
4
|
+
* @param blockSizeBytes - Block size in bytes
|
|
5
|
+
* @returns Padded data (or empty array if data is empty)
|
|
6
|
+
*/
|
|
7
|
+
export function zeroPad(data, blockSizeBytes) {
|
|
8
|
+
if (data.length === 0)
|
|
9
|
+
return new Uint8Array(0);
|
|
10
|
+
const paddedLen = Math.ceil(data.length / blockSizeBytes) * blockSizeBytes;
|
|
11
|
+
if (paddedLen === data.length)
|
|
12
|
+
return new Uint8Array(data);
|
|
13
|
+
const padded = new Uint8Array(paddedLen);
|
|
14
|
+
padded.set(data);
|
|
15
|
+
return padded;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Compares two byte arrays in constant time to prevent timing attacks.
|
|
19
|
+
* @param a - First byte array
|
|
20
|
+
* @param b - Second byte array
|
|
21
|
+
* @returns True if arrays are equal, false otherwise
|
|
22
|
+
*/
|
|
23
|
+
export function constantTimeEqual(a, b) {
|
|
24
|
+
if (a.length !== b.length)
|
|
25
|
+
return false;
|
|
26
|
+
let diff = 0;
|
|
27
|
+
for (let i = 0; i < a.length; i++) {
|
|
28
|
+
diff |= a[i] ^ b[i];
|
|
29
|
+
}
|
|
30
|
+
return diff === 0;
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aegis-aead",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "AEGIS authenticated encryption algorithms",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
|
-
"src",
|
|
19
18
|
"LICENSE",
|
|
20
19
|
"README.md"
|
|
21
20
|
],
|
|
@@ -31,9 +30,10 @@
|
|
|
31
30
|
"bench": "bun run bench/benchmark.ts"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
34
|
-
"@biomejs/biome": "^2.
|
|
35
|
-
"@
|
|
36
|
-
"
|
|
33
|
+
"@biomejs/biome": "^2.4.16",
|
|
34
|
+
"@noble/ciphers": "^2.2.0",
|
|
35
|
+
"@types/bun": "^1.3.14",
|
|
36
|
+
"typescript": "^6.0.3"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|
|
39
39
|
"aegis",
|
|
@@ -58,4 +58,4 @@
|
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=18"
|
|
60
60
|
}
|
|
61
|
-
}
|
|
61
|
+
}
|
package/dist/aegis128l-bs.d.ts
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bitsliced AEGIS-128L implementation.
|
|
3
|
-
* Provides constant-time operation by processing all 8 state blocks simultaneously.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Bitsliced AEGIS-128L cipher state.
|
|
7
|
-
* Uses 8 AES blocks (128 bytes) stored in bitsliced form (32 uint32 words).
|
|
8
|
-
*/
|
|
9
|
-
export declare class Aegis128LBsState {
|
|
10
|
-
private st;
|
|
11
|
-
private st1;
|
|
12
|
-
private tmp0;
|
|
13
|
-
private tmp1;
|
|
14
|
-
private z0;
|
|
15
|
-
private z1;
|
|
16
|
-
constructor();
|
|
17
|
-
/**
|
|
18
|
-
* AEGIS round function: applies AES round to all blocks and rotates.
|
|
19
|
-
* st[i] = AES(st[i]) ^ st[(i-1) mod 8]
|
|
20
|
-
*/
|
|
21
|
-
private aegisRound;
|
|
22
|
-
/**
|
|
23
|
-
* AEGIS round function with constant input (used in packed mode).
|
|
24
|
-
*/
|
|
25
|
-
private aegisRoundPacked;
|
|
26
|
-
/**
|
|
27
|
-
* Pack constant input for blocks 0 and 4.
|
|
28
|
-
*/
|
|
29
|
-
private packConstantInput;
|
|
30
|
-
/**
|
|
31
|
-
* Absorb rate: XOR message blocks into state positions 0 and 4.
|
|
32
|
-
*/
|
|
33
|
-
private absorbRate;
|
|
34
|
-
/**
|
|
35
|
-
* Update state with two message blocks.
|
|
36
|
-
*/
|
|
37
|
-
private update;
|
|
38
|
-
/**
|
|
39
|
-
* Initializes the state with a key and nonce.
|
|
40
|
-
* @param key - 16-byte encryption key
|
|
41
|
-
* @param nonce - 16-byte nonce (must be unique per message)
|
|
42
|
-
*/
|
|
43
|
-
init(key: Uint8Array, nonce: Uint8Array): void;
|
|
44
|
-
/**
|
|
45
|
-
* Absorbs a 32-byte associated data block into the state.
|
|
46
|
-
* @param ai - 32-byte associated data block
|
|
47
|
-
*/
|
|
48
|
-
absorb(ai: Uint8Array): void;
|
|
49
|
-
/**
|
|
50
|
-
* Encrypts a 32-byte plaintext block and writes to output buffer.
|
|
51
|
-
* @param xi - 32-byte plaintext block
|
|
52
|
-
* @param out - 32-byte output buffer
|
|
53
|
-
*/
|
|
54
|
-
encTo(xi: Uint8Array, out: Uint8Array): void;
|
|
55
|
-
/**
|
|
56
|
-
* Encrypts a 32-byte plaintext block.
|
|
57
|
-
* @param xi - 32-byte plaintext block
|
|
58
|
-
* @returns 32-byte ciphertext block
|
|
59
|
-
*/
|
|
60
|
-
enc(xi: Uint8Array): Uint8Array;
|
|
61
|
-
/**
|
|
62
|
-
* Decrypts a 32-byte ciphertext block and writes to output buffer.
|
|
63
|
-
* @param ci - 32-byte ciphertext block
|
|
64
|
-
* @param out - 32-byte output buffer
|
|
65
|
-
*/
|
|
66
|
-
decTo(ci: Uint8Array, out: Uint8Array): void;
|
|
67
|
-
/**
|
|
68
|
-
* Decrypts a 32-byte ciphertext block.
|
|
69
|
-
* @param ci - 32-byte ciphertext block
|
|
70
|
-
* @returns 32-byte plaintext block
|
|
71
|
-
*/
|
|
72
|
-
dec(ci: Uint8Array): Uint8Array;
|
|
73
|
-
/**
|
|
74
|
-
* Encrypts a 32-byte plaintext block in-place.
|
|
75
|
-
* @param block - 32-byte buffer (plaintext in, ciphertext out)
|
|
76
|
-
*/
|
|
77
|
-
encInPlace(block: Uint8Array): void;
|
|
78
|
-
/**
|
|
79
|
-
* Decrypts a 32-byte ciphertext block in-place.
|
|
80
|
-
* @param block - 32-byte buffer (ciphertext in, plaintext out)
|
|
81
|
-
*/
|
|
82
|
-
decInPlace(block: Uint8Array): void;
|
|
83
|
-
/**
|
|
84
|
-
* Decrypts a partial (final) ciphertext block smaller than 32 bytes.
|
|
85
|
-
* @param cn - Partial ciphertext block (1-31 bytes)
|
|
86
|
-
* @returns Decrypted plaintext of the same length
|
|
87
|
-
*/
|
|
88
|
-
decPartial(cn: Uint8Array): Uint8Array;
|
|
89
|
-
/**
|
|
90
|
-
* Finalizes encryption/decryption and produces an authentication tag.
|
|
91
|
-
* @param adLen - Associated data length in bytes
|
|
92
|
-
* @param msgLen - Message length in bytes
|
|
93
|
-
* @param tagLen - Tag length (16 or 32 bytes)
|
|
94
|
-
* @returns Authentication tag
|
|
95
|
-
*/
|
|
96
|
-
finalize(adLen: number, msgLen: number, tagLen?: 16 | 32): Uint8Array;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Encrypts a message using bitsliced AEGIS-128L (detached mode).
|
|
100
|
-
* @param msg - Plaintext message
|
|
101
|
-
* @param ad - Associated data (authenticated but not encrypted)
|
|
102
|
-
* @param key - 16-byte encryption key
|
|
103
|
-
* @param nonce - 16-byte nonce (must be unique per message with the same key)
|
|
104
|
-
* @param tagLen - Authentication tag length: 16 or 32 bytes (default: 16)
|
|
105
|
-
* @returns Object containing ciphertext and authentication tag separately
|
|
106
|
-
*/
|
|
107
|
-
export declare function aegis128LBsEncryptDetached(msg: Uint8Array, ad: Uint8Array, key: Uint8Array, nonce: Uint8Array, tagLen?: 16 | 32): {
|
|
108
|
-
ciphertext: Uint8Array;
|
|
109
|
-
tag: Uint8Array;
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Decrypts a message using bitsliced AEGIS-128L (detached mode).
|
|
113
|
-
* @param ct - Ciphertext
|
|
114
|
-
* @param tag - Authentication tag (16 or 32 bytes)
|
|
115
|
-
* @param ad - Associated data (must match what was used during encryption)
|
|
116
|
-
* @param key - 16-byte encryption key
|
|
117
|
-
* @param nonce - 16-byte nonce (must match what was used during encryption)
|
|
118
|
-
* @returns Decrypted plaintext, or null if authentication fails
|
|
119
|
-
*/
|
|
120
|
-
export declare function aegis128LBsDecryptDetached(ct: Uint8Array, tag: Uint8Array, ad: Uint8Array, key: Uint8Array, nonce: Uint8Array): Uint8Array | null;
|
|
121
|
-
/**
|
|
122
|
-
* Encrypts a message in-place using bitsliced AEGIS-128L (detached mode).
|
|
123
|
-
* The input buffer is modified to contain the ciphertext.
|
|
124
|
-
* @param data - Buffer containing plaintext (will be overwritten with ciphertext)
|
|
125
|
-
* @param ad - Associated data (authenticated but not encrypted)
|
|
126
|
-
* @param key - 16-byte encryption key
|
|
127
|
-
* @param nonce - 16-byte nonce (must be unique per message with the same key)
|
|
128
|
-
* @param tagLen - Authentication tag length: 16 or 32 bytes (default: 16)
|
|
129
|
-
* @returns Authentication tag
|
|
130
|
-
*/
|
|
131
|
-
export declare function aegis128LBsEncryptDetachedInPlace(data: Uint8Array, ad: Uint8Array, key: Uint8Array, nonce: Uint8Array, tagLen?: 16 | 32): Uint8Array;
|
|
132
|
-
/**
|
|
133
|
-
* Decrypts a message in-place using bitsliced AEGIS-128L (detached mode).
|
|
134
|
-
* The input buffer is modified to contain the plaintext (or zeroed on failure).
|
|
135
|
-
* @param data - Buffer containing ciphertext (will be overwritten with plaintext)
|
|
136
|
-
* @param tag - Authentication tag (16 or 32 bytes)
|
|
137
|
-
* @param ad - Associated data (must match what was used during encryption)
|
|
138
|
-
* @param key - 16-byte encryption key
|
|
139
|
-
* @param nonce - 16-byte nonce (must match what was used during encryption)
|
|
140
|
-
* @returns True if authentication succeeds, false otherwise
|
|
141
|
-
*/
|
|
142
|
-
export declare function aegis128LBsDecryptDetachedInPlace(data: Uint8Array, tag: Uint8Array, ad: Uint8Array, key: Uint8Array, nonce: Uint8Array): boolean;
|
|
143
|
-
export declare const AEGIS_128L_BS_NONCE_SIZE = 16;
|
|
144
|
-
export declare const AEGIS_128L_BS_KEY_SIZE = 16;
|
|
145
|
-
/**
|
|
146
|
-
* Encrypts a message using bitsliced AEGIS-128L.
|
|
147
|
-
* Returns a single buffer containing nonce || ciphertext || tag.
|
|
148
|
-
* @param msg - Plaintext message
|
|
149
|
-
* @param ad - Associated data (authenticated but not encrypted)
|
|
150
|
-
* @param key - 16-byte encryption key
|
|
151
|
-
* @param nonce - 16-byte nonce (optional, generates random nonce if not provided)
|
|
152
|
-
* @param tagLen - Authentication tag length: 16 or 32 bytes (default: 16)
|
|
153
|
-
* @returns Concatenated nonce || ciphertext || tag
|
|
154
|
-
*/
|
|
155
|
-
export declare function aegis128LBsEncrypt(msg: Uint8Array, ad: Uint8Array, key: Uint8Array, nonce?: Uint8Array | null, tagLen?: 16 | 32): Uint8Array;
|
|
156
|
-
/**
|
|
157
|
-
* Decrypts a message using bitsliced AEGIS-128L.
|
|
158
|
-
* Expects input as nonce || ciphertext || tag.
|
|
159
|
-
* @param sealed - Concatenated nonce || ciphertext || tag
|
|
160
|
-
* @param ad - Associated data (must match what was used during encryption)
|
|
161
|
-
* @param key - 16-byte encryption key
|
|
162
|
-
* @param tagLen - Authentication tag length: 16 or 32 bytes (default: 16)
|
|
163
|
-
* @returns Decrypted plaintext, or null if authentication fails
|
|
164
|
-
*/
|
|
165
|
-
export declare function aegis128LBsDecrypt(sealed: Uint8Array, ad: Uint8Array, key: Uint8Array, tagLen?: 16 | 32): Uint8Array | null;
|
|
166
|
-
/**
|
|
167
|
-
* Computes a MAC (Message Authentication Code) using bitsliced AEGIS-128L.
|
|
168
|
-
* @param data - Data to authenticate
|
|
169
|
-
* @param key - 16-byte key
|
|
170
|
-
* @param nonce - 16-byte nonce (optional, uses zero nonce if null)
|
|
171
|
-
* @param tagLen - Tag length: 16 or 32 bytes (default: 16)
|
|
172
|
-
* @returns Authentication tag
|
|
173
|
-
*/
|
|
174
|
-
export declare function aegis128LBsMac(data: Uint8Array, key: Uint8Array, nonce?: Uint8Array | null, tagLen?: 16 | 32): Uint8Array;
|
|
175
|
-
/**
|
|
176
|
-
* Verifies a MAC computed using bitsliced AEGIS-128L.
|
|
177
|
-
* @param data - Data to verify
|
|
178
|
-
* @param tag - Expected authentication tag (16 or 32 bytes)
|
|
179
|
-
* @param key - 16-byte key
|
|
180
|
-
* @param nonce - 16-byte nonce (optional, uses zero nonce if null)
|
|
181
|
-
* @returns True if the tag is valid, false otherwise
|
|
182
|
-
*/
|
|
183
|
-
export declare function aegis128LBsMacVerify(data: Uint8Array, tag: Uint8Array, key: Uint8Array, nonce?: Uint8Array | null): boolean;
|
|
184
|
-
/**
|
|
185
|
-
* Generates a random 16-byte key for bitsliced AEGIS-128L.
|
|
186
|
-
* @returns 16-byte encryption key
|
|
187
|
-
*/
|
|
188
|
-
export declare function aegis128LBsCreateKey(): Uint8Array;
|
|
189
|
-
/**
|
|
190
|
-
* Generates a random 16-byte nonce for bitsliced AEGIS-128L.
|
|
191
|
-
* @returns 16-byte nonce
|
|
192
|
-
*/
|
|
193
|
-
export declare function aegis128LBsCreateNonce(): Uint8Array;
|
|
194
|
-
//# sourceMappingURL=aegis128l-bs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aegis128l-bs.d.ts","sourceRoot":"","sources":["../src/aegis128l-bs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+BH;;;GAGG;AACH,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,EAAE,CAAY;IACtB,OAAO,CAAC,GAAG,CAAY;IACvB,OAAO,CAAC,IAAI,CAAW;IACvB,OAAO,CAAC,IAAI,CAAW;IACvB,OAAO,CA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