Hashes/Cripto
AES Encrypt/Decrypt
Criptografe e descriptografe texto com AES-GCM ou AES-CBC usando uma senha (chave derivada via PBKDF2).
AES is the standard for symmetric encryption: the same password is used to both encrypt and decrypt. This tool derives an encryption key from your password with PBKDF2 and encrypts text with AES-GCM or AES-CBC — all locally in your browser.
How to use it
- Encrypt: enter text and a password, pick a mode (GCM or CBC), and get an encrypted result along with the parameters (salt, IV) needed to decrypt it later.
- Decrypt: paste the encrypted text and the same password to get the original back.
- AES-GCM is the recommended default: it encrypts and verifies data integrity at the same time (authenticated encryption).
Common uses
- Encrypting sensitive text before storing it or sending it over an untrusted channel.
- Checking that an AES encryption implementation matches across different languages or libraries.
- A teaching example for understanding the difference between the GCM and CBC encryption modes.
Things to keep in mind
The IV (initialization vector) must be unique for every encryption performed with the same key — reusing a key+IV pair in GCM completely breaks the encryption's security.
AES-CBC without a separate integrity check (a MAC) is vulnerable to ciphertext-tampering attacks — that's why GCM, which combines encryption and authentication in one mode, is the safer default.
Artigo sobre esta ferramenta: AES: como funciona a criptografia simétrica
Perguntas frequentes
Quais tamanhos de chave o AES suporta aqui e qual devo usar?
O AES suporta chaves de 128, 192 e 256 bits. AES-256 é a recomendação comum para novas aplicações, já que 128 bits já é considerado seguro, mas 256 bits dá margem extra com custo prático desprezível.
Qual a diferença entre os modos de cifra (como CBC, GCM)?
O GCM autentica o texto cifrado enquanto criptografa, então também detecta adulteração, sendo a opção padrão recomendada. O CBC apenas criptografa e precisa de um MAC separado para integridade, além de um IV aleatório a cada criptografia para se manter seguro.
Minha chave ou texto simples é enviado para algum lugar?
Não. Toda a criptografia e descriptografia rodam localmente no seu navegador via Web Crypto API — nada é enviado a um servidor.
Por que não devo usar o modo ECB?
O ECB criptografa cada bloco de forma independente e idêntica, então blocos iguais de texto simples geram blocos iguais de texto cifrado — isso revela a estrutura dos dados (por exemplo, padrões repetidos em uma imagem permanecem visíveis mesmo criptografados). O CBC ou o GCM com um IV único eliminam esse problema.
O que acontece se eu reutilizar o mesmo IV com a mesma chave?
Para o GCM, isso é um erro crítico — reutilizar o par chave+IV compromete completamente a confidencialidade e a autenticidade da criptografia. O IV sempre deve ser único para cada criptografia com a mesma chave.