ハッシュ/暗号
PBKDF2 Hash + Verify
パスワードからPBKDF2(RFC 8018、HMAC-SHA1/256/384/512)で鍵を導出。反復回数は調整可能。
PBKDF2 (RFC 8018) applies HMAC to a password and salt repeatedly to deliberately slow down computation — it's the oldest of the standardized algorithms for password hashing and encryption key derivation.
How to use it
- Derive: enter a password, pick an HMAC algorithm (SHA-1/256/384/512), and set the iteration count to get a derived key of the requested length.
- Verify: paste a password and an existing PBKDF2 hash to check whether they match, without recomputing it manually.
- More iterations means slower, more secure computation — tune the value to your server's response-time budget.
Common uses
- Deriving an encryption key from a user's password for a file container or a custom protocol.
- Checking a PBKDF2 implementation for compatibility across programming languages (the parameters must match exactly).
- Hashing passwords in systems that require a FIPS-compliant algorithm (PBKDF2 is NIST-approved).
Things to keep in mind
Unlike bcrypt and Argon2, PBKDF2 isn't memory-hard — it only requires CPU time, so it's less resistant to attacks on GPUs with many parallel compute units.
The recommended iteration count rises over time in NIST and OWASP guidance as hardware gets faster — check against current recommendations periodically.
よくある質問
パスワードハッシュにおいてPBKDF2はbcryptやArgon2とどう違いますか?
PBKDF2はHMACハッシュ関数を繰り返し適用してブルートフォースを遅くしますが、bcryptやArgon2と異なりメモリハードではないため、GPUでの解読が比較的安価です。今なお広く使われFIPS承認されていますが、新規システムには一般的にArgon2が好まれます。
反復回数は何を制御し、どのくらい高くすべきですか?
反復回数は基礎となるハッシュを何回適用するかを設定し、速度とブルートフォース耐性を直接トレードオフします。現在の指針ではSHA-256で数十万回の反復が推奨され、ハードウェアが高速化するにつれて時間とともに引き上げられます。
PBKDF2にソルトが必要なのはなぜですか?
ソルトは同一のパスワードが異なる出力を生成することを保証し、攻撃者が事前計算されたレインボーテーブルを使うことを防ぎ、各ハッシュを個別に攻撃せざるを得なくします。
PBKDF2が使う基礎ハッシュ関数の種類は重要ですか?
はい。古い実装ではデフォルトでHMAC-SHA1が使われることがよくありました——HMACの構造の中ではこれは致命的な脆弱性ではありませんが、現代の指針は速度をほとんど損なうことなくより大きな安全マージンを得るために、明確にHMAC-SHA256以上を推奨しています。
パスワード保存以外にPBKDF2はどこで使われていますか?
PBKDF2はパスワードから暗号化鍵を導出するために広く使われています——例えば、Wi-FiのWPA2/WPA3や、多くの暗号化ファイルコンテナ形式などです。