AES-256-GCM暗号化・復号テスト

パスフレーズとPBKDF2鍵導出を使い、ブラウザでAES-256-GCMを試せます。

// about

ツールについて

AES-256-GCMで暗号化し、PBKDF2-SHA-256で鍵を導出します。学習とローカルテスト向けで、本番の鍵管理の代わりにはなりません。

使い方

  1. 暗号化するテキストまたは復号するデータを入力します。
  2. 同じパスフレーズを入力し、暗号化または復号を選びます。
  3. 結果をコピーし、本番用の秘密情報は再利用しないでください。

このツールが使われる理由

  • 平文をアップロードせずに暗号化と復号を試せます。
  • パスフレーズと反復回数を指定できます。
  • 出力には復号に必要な情報が含まれます。

よくある質問 (FAQ)

本番の秘密情報に使えますか?

いいえ。本番では検証済みの暗号設計と鍵保管を利用してください。

ガイド · セキュリティ · 4分で読めます

ハッシュ関数をやさしく解説:MD5・SHA-1・SHA-256の違いと正しい使い方

ダウンロードのチェックサム、Gitのコミット ID、ブロックチェーンのアドレスはすべてハッシュ値です。このガイドでは、ハッシュと暗号化の違いと、用途ごとにどのアルゴリズムを選ぶべきかを説明します。

ハッシュ関数は、任意の長さの入力から固定長の短い値を作ります。これをハッシュ値またはダイジェストと呼びます。1単語でも数ギガバイトの動画でも、SHA-256の出力は常に256ビット、つまり16進数64文字です。

SHA-256("hello")  = 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
SHA-256("hello!") = ce06092fb948d9ffac7d1a376e404b26b7575bcc11ee05a4615fef4fec3a308b
MD5("hello")      = 5d41402abc4b2a76b9719d911017c592
良いハッシュ関数の3つの性質、MD5とSHA-1がセキュリティ用途で使われなくなった理由、ファイルの整合性確認やパスワード保存での正しいハッシュの使い方を解説します。
ガイドを読む →
AIで作る

このツールをAIで自作してみましょう

自分用のバージョンが必要なら、作業指示プロンプトをAIチャットに貼り付けるか、スキルファイルをAIコーディングエージェントに保存してください。私たちが開発時に整理した機能、例外、テストケースが含まれています。

プロンプトとスキルは英語で提供しています。AIツールはどの言語でもよく理解できます。

AI作業指示プロンプト

Claude、ChatGPT、GeminiなどのAIチャットにそのまま貼り付けてください。

You are an experienced full-stack web developer. Build a web tool called "AES暗号化テストツール" that meets the requirements below.

## Goal

Build a tester that encrypts and decrypts text with AES-256-GCM using a password.

## Core features

- Encrypt and decrypt modes
- Derive the key from the password with PBKDF2 and a high iteration count
- Random salt and 12-byte IV for every encryption
- Output salt + IV + ciphertext as one Base64 string
- Copy result

## Inputs

- Plain text or Base64 ciphertext
- Password

## Outputs

- Base64 ciphertext or decrypted plain text
- Summary of algorithm and parameters

## Edge cases and handling rules

- Show 'authentication failed' for a wrong password or tampered ciphertext
- Reject empty passwords
- Explain that the same plain text encrypts differently each time
- Use the Web Crypto API so keys and text never leave the browser

## Implementation requirements

- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
- Make the UI responsive and easy to use on mobile; label every input and keep everything keyboard accessible.
- Add a Copy button for results and show clear, friendly error messages for invalid input.
- Keep the core logic in functions separate from the UI so it can be unit-tested.

## Definition of done (test cases)

- Encrypt then decrypt with the same password returns the original
- Changing one character of the ciphertext makes decryption fail
- Encrypting the same input twice gives different output

First outline your implementation plan in at most five lines, then write the complete code, and finally explain how to check the test cases above.

スキル (SKILL.md)

Claude CodeなどのAIコーディングエージェントで .claude/skills/build-encryption-tester/SKILL.md に保存すると、このツールを作る・直すたびに再利用できます。

---
name: build-encryption-tester
description: Use when building or changing a AES暗号化テストツール tool. Build a tester that encrypts and decrypts text with AES-256-GCM using a password.
---

# Build: AES暗号化テストツール

## Goal

Build a tester that encrypts and decrypts text with AES-256-GCM using a password.

## Workflow

1. Review the required features, inputs and outputs below and ask about anything missing first.
2. Implement the core logic as pure functions separate from the UI.
3. Check the logic against the test cases in the verification list.
4. Build a responsive UI with an input form, a result area and a Copy button.
5. Reproduce each edge case listed under Rules and refine the error messages.

## Core features

- Encrypt and decrypt modes
- Derive the key from the password with PBKDF2 and a high iteration count
- Random salt and 12-byte IV for every encryption
- Output salt + IV + ciphertext as one Base64 string
- Copy result

## Inputs

- Plain text or Base64 ciphertext
- Password

## Outputs

- Base64 ciphertext or decrypted plain text
- Summary of algorithm and parameters

## Rules

- Show 'authentication failed' for a wrong password or tampered ciphertext
- Reject empty passwords
- Explain that the same plain text encrypts differently each time
- Use the Web Crypto API so keys and text never leave the browser
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.

## Verification

- [ ] Encrypt then decrypt with the same password returns the original
- [ ] Changing one character of the ciphertext makes decryption fail
- [ ] Encrypting the same input twice gives different output

AIに任せるときのコツ

  • 最初の行に使用技術(React、Vue、素のHTMLなど)を書くと、プロジェクトに合ったコードになります。
  • コードを受け取る前に、テストケースを実行して結果を見せるよう依頼しましょう。
  • 本物のパスワード、顧客データ、APIキーは入力せず、サンプル値を使ってください。