StaticgetGenerate a random 16-byte AES IV.
A 16-byte Uint8Array suitable for use as an IV.
StaticencryptEncrypt blocks of data with AES-256-GCM.
Blocks of plaintext to encrypt.
32-byte symmetric key.
Ciphertext bundle: iv, auth tag, and per-block encrypted data.
StaticdecryptDecrypt a ciphertext bundle produced by encryptGCM.
Bundle of iv, tag, and per-block data.
32-byte symmetric key.
Per-block decrypted plaintext.
StaticencryptEncrypt blocks of data with AES-256-CTR.
Blocks of plaintext to encrypt.
32-byte symmetric key.
Ciphertext bundle: iv and per-block encrypted data (no auth tag).
StaticdecryptDecrypt a ciphertext bundle produced by encryptCTR.
Bundle of iv and per-block data.
32-byte symmetric key.
Per-block decrypted plaintext.
AES-256 encryption helpers in GCM (authenticated) and CTR (streaming) modes.
All inputs and outputs are
Uint8Array. Keys must be 32 bytes; IVs are generated internally on encrypt and read from the ciphertext bundle on decrypt. GCM and CTR are counter-mode stream ciphers, so the per-block data layout is preserved by encrypting the concatenated blocks in one shot and re-splitting the result at the original block boundaries.