เข้ารหัสและถอดรหัส AES
Please read before use
• This tool runs entirely in your browser. No plaintext, ciphertext, or key is sent to a server.
• It is intended for development, debugging, learning and self-managed scenarios. Do not use this page as the only protection for production secrets, customer data, or anything that requires auditing.
• For real applications: use audited libraries (libsodium, OpenSSL, AWS Encryption SDK), a real KDF (Argon2id ≥ 1 iteration / 64 MiB), AEAD modes only, and manage keys on the server with proper access control.
ข้อความ UTF-8
Mode comparison — GCM vs CBC vs CTR▼
| Mode | Authentication | IV requirement | Performance | Recommended use |
|---|---|---|---|---|
| AES-GCM | Yes (AEAD, 128-bit tag) | 12 bytes (recommended); never reuse with same key | Fast, hardware-accelerated | Default — modern API, file encryption, anything authenticated |
| AES-CBC | No — must add HMAC/MAC | 16 bytes; unpredictable (CSPRNG) and never reuse | Fast, hardware-accelerated | Legacy TLS, disk encryption (XTS-AES), never use raw for new designs |
| AES-CTR | No — must add HMAC/MAC | 16 bytes; never reuse with same key (catastrophic if reused) | Fastest, parallelizable | Random-access streams, disk encryption, but combine with MAC |
Reading the table
- • AES-GCM is the only AEAD among the three — it both encrypts and authenticates in one step. If you don't know which to choose, choose GCM.
- • CBC and CTR only provide confidentiality. They need a separate MAC (HMAC-SHA256, compute-then-MAC) or they are vulnerable to chosen-ciphertext and bit-flipping attacks.
- • Both IV and nonce must be unique per (key, message). GCM with a reused IV leaks the authentication key — treat as catastrophic.
หมายเหตุเกี่ยวกับโหมดและรูปแบบ
- • SubtleCrypto ของเบราว์เซอร์รองรับ AES เฉพาะ GCM, CBC และ CTR — ไม่รวม ECB, CFB หรือ OFB (เพื่อป้องกันการใช้แบบอ่อน) หากต้องการโหมดอื่น โปรดใช้ OpenSSL หรือไลบรารีฝั่งเซิร์ฟเวอร์
- • รูปแบบข้อความเข้ารหัสให้เลือก: Hex / Base64 / Base64URL เข้ากันได้กับ CyberChef, API, JWT เป็นต้น ทั้งสองฝั่ง (เข้ารหัสและถอดรหัส) ต้องเลือกรูปแบบเดียวกัน
- • ใน AES-GCM ผลลัพธ์คือสตรีมไบต์ต่อเนื่องของ 「ข้อความเข้ารหัส + แท็กยืนยันตัวตน」 เครื่องมือนี้จะเข้ารหัสทั้งบล็อกในรูปแบบที่เลือก — วางทั้งบล็อกเมื่อถอดรหัส
หมายเหตุ
- • Web Crypto ทำงานในเบราว์เซอร์ทั้งหมด GCM เป็นการเข้ารหัสแบบยืนยันตัวตน เหมาะสำหรับสถานการณ์เริ่มต้น
- • เมื่อเข้ารหัส ให้เว้น IV ว่าง: เครื่องมือจะสร้าง IV สุ่มและเติมในช่องด้านบน เพื่อใช้ซ้ำเมื่อถอดรหัส
- • เมื่อถอดรหัส ให้เว้น IV ว่างเพื่อลองใช้เวกเตอร์ศูนย์ทั้งหมด (ใช้ได้เฉพาะเมื่ออีกฝ่ายใช้ข้อตกลงเดียวกัน)
เครื่องมือออนไลน์ฟรีสำหรับเข้ารหัสและถอดรหัส AES ด้วย AES-CBC, AES-GCM และ AES-CTR รองรับคีย์ AES-128/192/256, รูปแบบ ciphertext แบบ Hex/Base64/Base64URL, การสร้างคีย์จากรหัสผ่านด้วย PBKDF2-SHA256, การสร้าง IV/salt แบบสุ่ม และการประมวลผล Web Crypto เฉพาะในเบราว์เซอร์