Chuyển đến nội dung chính

AES Encrypt / Decrypt

Lập trình

Sending a config file or a password over a chat app means it sits in someone's history forever. Encrypt it first: pick a password, get a block of text starting with `AESGCM1.`, and the other side can restore it with the same password. It uses the browser's native WebCrypto AES-256-GCM — authenticated encryption, so if even one character of the ciphertext is altered, decryption fails outright instead of returning garbage.

Đang tải công cụ…

Cách dùng

4 bước
  1. 01

    Choose Encrypt, paste the text, and set a password you will remember.

  2. 02

    Press Run to get a payload starting with `AESGCM1.`; send payload and password over two different channels.

  3. 03

    To restore, switch to Decrypt, paste the payload and the same password.

  4. 04

    A wrong password or a modified payload fails loudly — that is GCM's authentication tag doing its job.

Technical Notes & Guide

1

Why the payload carries a salt and an IV

Using a password directly as an AES key means identical plaintext always produces identical ciphertext, which lets an observer see which messages match and enables precomputed tables. Every encryption here generates a 16-byte random salt and a 12-byte IV packed with the ciphertext, so encrypting the same text twice yields different results — that is correct behaviour, not instability. The password is turned into a key through PBKDF2-SHA256 with 200,000 iterations to make guessing expensive.

Câu hỏi thường gặp

2 câu hỏi
Q1Is my password or plaintext sent anywhere?

No. Key derivation and encryption run in `crypto.subtle` inside your browser tab; the page makes no request carrying either value, and it works offline.

Q2Can I recover the text if I forget the password?

No. The key exists only as a derivation of the password, and nothing is stored. Treat a lost password as a corrupted file.

Lập trình