Encrypt and decrypt text or files using AES, entirely in your browser.
The Advanced Encryption Standard (AES) is a symmetric encryption algorithm established by NIST in 2001. "Symmetric" means the exact same key is used to both encrypt and decrypt the data.
AES is a block cipher. It doesn't encrypt the data letter by letter; instead, it breaks the plaintext into 128-bit blocks and scrambles each block through a complex mathematical process (substitution, permutation, and mixing) over multiple rounds.
Because encrypting the exact same block of text with the same key always produces the exact same output, block ciphers use "modes of operation" and an Initialization Vector (IV) to introduce randomness.
AES mathematically requires a cryptographic key of an exact length (e.g., 256 bits). However, humans use passwords of varying lengths. To solve this, we use a Key Derivation Function (KDF) like PBKDF2.
PBKDF2 takes the human password, adds a random Salt, and hashes it thousands of times (iterations) to stretch it into a perfect 256-bit AES key while intentionally slowing down brute-force attackers.
When using AES-GCM, the Initialization Vector (IV) must be strictly unique (a nonce) for every single encryption operation using the same key.
Catastrophic Failure: If you ever reuse the exact same IV and Key combination twice in AES-GCM, an attacker can mathematically recover the authentication key and easily forge messages! Never hardcode the IV; always generate a new random IV using crypto.getRandomValues() for every encryption.
What is the primary advantage of AES-GCM over AES-CBC?