ハッシュ/暗号
AES Encrypt/Decrypt
パスワードを使ってAES-GCMまたはAES-CBCでテキストを暗号化・復号(鍵は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.
よくある質問
ここでAESが対応する鍵長は何で、どれを使うべきですか?
AESは128、192、256ビットの鍵に対応しています。新しいアプリケーションにはAES-256が一般的に推奨されます。128ビットもすでに安全とされていますが、256ビットは実質的なコストをほとんどかけずに余裕を持たせられます。
暗号モード(CBC、GCMなど)の違いは何ですか?
GCMは暗号化と同時に暗号文を認証するため、改ざんも検出でき、推奨されるデフォルトです。CBCは暗号化のみで、完全性のために別途MACが必要であり、安全性を保つには暗号化ごとにランダムなIVも必要です。
私の鍵や平文はどこかに送信されますか?
いいえ。すべての暗号化・復号はWeb Crypto APIを使ってブラウザ内でローカルに実行され、サーバーには何も送信されません。
なぜECBモードを使うべきではないのですか?
ECBは各ブロックを独立して同じ方法で暗号化するため、同じ平文ブロックは同じ暗号文ブロックになります——これはデータの構造を露呈させます(例えば、画像内の繰り返しパターンは暗号化後も見えたままになります)。一意のIVを使うCBCやGCMはこの問題を解消します。
同じ鍵で同じIVを再利用するとどうなりますか?
GCMにとってこれは致命的な誤りです——鍵とIVの組み合わせを再利用すると、暗号化の機密性と真正性が完全に損なわれます。IVは同じ鍵での暗号化ごとに常に一意でなければなりません。