@@ -142,7 +142,7 @@ const ciphertext = chacha.encrypt(data);
142
142
const data_ = chacha .decrypt (ciphertext);
143
143
```
144
144
145
- #### AES: gcm, siv, ctr, cfb, cbc, ecb
145
+ #### AES: gcm, siv, ctr, cfb, cbc, ecb, aeskw
146
146
147
147
``` js
148
148
import { gcm , siv , ctr , cfb , cbc , ecb } from ' @noble/ciphers/aes' ;
@@ -165,6 +165,14 @@ for (const cipher of [ecb]) {
165
165
const ciphertext_ = cipher (key).encrypt (plaintext);
166
166
const plaintext_ = cipher (key).decrypt (ciphertext_);
167
167
}
168
+
169
+ // AESKW, AESKWP
170
+ import { aeskw , aeskwp } from ' @noble/ciphers/aes' ;
171
+ import { hexToBytes } from ' @noble/ciphers/utils' ;
172
+
173
+ const kek = hexToBytes (' 000102030405060708090A0B0C0D0E0F' );
174
+ const keyData = hexToBytes (' 00112233445566778899AABBCCDDEEFF' );
175
+ const ciphertext = aeskw (kek).encrypt (keyData);
168
176
```
169
177
170
178
#### AES: friendly WebCrypto wrapper
@@ -190,17 +198,6 @@ for (const cipher of [ctr, cbc]) {
190
198
}
191
199
```
192
200
193
- #### AES: AESKW and AESKWP
194
-
195
- ``` ts
196
- import { aeskw , aeskwp } from ' @noble/ciphers/aes' ;
197
- import { hexToBytes } from ' @noble/ciphers/utils' ;
198
-
199
- const kek = hexToBytes (' 000102030405060708090A0B0C0D0E0F' );
200
- const keyData = hexToBytes (' 00112233445566778899AABBCCDDEEFF' );
201
- const ciphertext = aeskw (kek ).encrypt (keyData );
202
- ```
203
-
204
201
#### Reuse array for input and output
205
202
206
203
To avoid additional allocations, Uint8Array can be reused
0 commit comments