Skip to content

Commit 96cb825

Browse files
committed
readme
1 parent b574cda commit 96cb825

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

‎README.md

+9-12
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ const ciphertext = chacha.encrypt(data);
142142
const data_ = chacha.decrypt(ciphertext);
143143
```
144144

145-
#### AES: gcm, siv, ctr, cfb, cbc, ecb
145+
#### AES: gcm, siv, ctr, cfb, cbc, ecb, aeskw
146146

147147
```js
148148
import { gcm, siv, ctr, cfb, cbc, ecb } from '@noble/ciphers/aes';
@@ -165,6 +165,14 @@ for (const cipher of [ecb]) {
165165
const ciphertext_ = cipher(key).encrypt(plaintext);
166166
const plaintext_ = cipher(key).decrypt(ciphertext_);
167167
}
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);
168176
```
169177

170178
#### AES: friendly WebCrypto wrapper
@@ -190,17 +198,6 @@ for (const cipher of [ctr, cbc]) {
190198
}
191199
```
192200

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-
204201
#### Reuse array for input and output
205202

206203
To avoid additional allocations, Uint8Array can be reused

0 commit comments

Comments
 (0)