PBKDF2 Hash Generator
PBKDF2でパスワードハッシュをブラウザ内で生成・検証します。反復回数・ソルト・アルゴリズムを指定可能。
OWASP目安: SHA-256は約60万回、SHA-512は約21万回。詳細はページ下部のFAQを参照してください。
「ハッシュを生成」を押すと自動生成されます(または再生成ボタンで先に作成できます)How to Use the PBKDF2 Hash Generator
This free online tool derives PBKDF2 password hashes directly in your browser. Switch to "生成" (Generate) mode, enter a password, choose the iteration count and hash algorithm, and a random 16-byte salt is generated automatically (with a regenerate button for a fresh one). The result is shown as hex, Base64, and a single encoded string in the format pbkdf2-sha256$<iterations>$<salt>$<hash>that you can store and copy directly. Switch to "検証" (Verify) mode to re-derive a hash from a plaintext password and an encoded string, and see whether they match.
What Is PBKDF2?
PBKDF2 (Password-Based Key Derivation Function 2) is a key-stretching algorithm defined in RFC 2898 (PKCS #5) and approved by NIST SP 800-132. It repeatedly applies an HMAC (based on SHA-256, SHA-384, or SHA-512) to a password and salt — thousands or hundreds of thousands of times — to make brute-force attacks computationally expensive. Because it is natively supported by the Web Crypto API (crypto.subtle.deriveBits), it can run efficiently and securely entirely inside a browser tab with no external library.
Why PBKDF2 Instead of bcrypt?
This tool was originally planned around bcrypt, but the Web Crypto API (SubtleCrypto) does not implement bcrypt, and this site avoids adding external npm dependencies for individual tools. PBKDF2, by contrast, is built directly into crypto.subtle.deriveBits, so it can be computed natively and safely in the browser. PBKDF2 is a NIST-approved, industry-standard algorithm and a legitimate choice, though modern guidance increasingly favors memory-hard alternatives like Argon2id when they are available server-side (see the FAQ below).
Choosing an Iteration Count and Algorithm
Higher iteration counts make brute-force attacks slower but also slow down legitimate logins, so the right number depends on your server's performance budget. OWASP's current guidance is a reasonable starting point: roughly 600,000 iterations for PBKDF2-HMAC-SHA256, or 210,000 for PBKDF2-HMAC-SHA512. This tool defaults to 210,000 iterations with SHA-256 for a quick demonstration — for production use, adjust both values to match current guidance for your chosen algorithm.
PBKDF2ハッシュ生成・検証ツールについて
パスワードからPBKDF2ハッシュをブラウザ内で生成・検証するツールです。「生成」モードではパスワード・反復回数・ハッシュアルゴリズムを指定すると16バイトのソルトが自動生成され、hex・Base64・pbkdf2-sha256$<反復回数>$<ソルト>$<ハッシュ>形式のエンコード済み文字列がその場で表示されます。「検証」モードでは平文パスワードとエンコード済み文字列を入力すると再計算し、一致・不一致を確認できます。
なぜbcryptではなくPBKDF2なのか
当初はbcryptでの実装を想定していましたが、ブラウザ標準のWeb Crypto API(SubtleCrypto)にはbcryptが実装されておらず、本サイトはツール単体のために外部npm依存を追加しない方針を取っています。一方PBKDF2はcrypto.subtle.deriveBitsにネイティブ実装されているため、追加ライブラリなしでブラウザ内で安全に計算できます。PBKDF2自体はNIST承認のアルゴリズムであり実用上有効な選択肢ですが、サーバーサイドで実装できるならArgon2id等のメモリハード関数がより推奨されるという点は、下部のFAQで補足しています。
実務での活用例
- 自作認証システムのハッシュ設計デバッグ -- 反復回数やソルトの生成・保存方法が想定通りに動くか、本ツールの出力とサーバー実装の出力を突き合わせて確認できます
- システム移行時のフォーマット確認 -- 別システムからPBKDF2ハッシュを移行する際、テスト値で本ツールを使い、反復回数・アルゴリズム・ソルトの意味を再現して移行スクリプトを検証できます
- 反復回数の妥当性レビュー -- 既存コードの反復回数が現在のOWASP目安と比べて十分かどうかを見積もる参考値として利用できます
よくある落とし穴と対処 / Common Pitfalls
| 落とし穴 / Pitfall | 問題 / Problem | 対処 / Fix |
|---|---|---|
| ソルトを複数アカウントで使い回す Reusing the same salt across passwords | 同じソルトを使うと、同一パスワードのユーザーが同じハッシュ値になり漏洩時に紐付けられる Reused salts let attackers correlate identical passwords across accounts | アカウント(レコード)ごとに必ず新しいソルトを生成する(本ツールも生成のたびに新規作成) Generate a fresh salt per account, as this tool does on every generation |
| 反復回数を低く設定しすぎる Setting iterations too low | 高速化されたハードウェア(GPU)で現実的な時間で総当たりされる Fast hardware can brute-force weak iteration counts in practical time | OWASP目安以上(SHA-256で60万・SHA-512で21万)を設定する Meet or exceed OWASP guidance for your chosen hash |
| 反復回数・アルゴリズムを保存せず後で検証できなくする Not storing the iteration count/algorithm used | 設定を変更すると過去に発行したハッシュを再現・検証できなくなる Changing settings makes old hashes unverifiable | エンコード済み文字列に反復回数とアルゴリズムを含め、検証時に読み取って動的に対応する Embed iterations and algorithm in the stored string and read them back at verify time |
| パスワードをUnicode正規化せずに扱う Not normalizing Unicode before hashing | 見た目が同じでもNFC/NFDでバイト列が異なり、同じパスワードなのに検証が失敗する Visually identical passwords can hash differently under NFC vs NFD | ハッシュ化前に normalize("NFC") を通すNormalize with .normalize("NFC") before hashing |
| ソルトをハッシュと別の場所に保存し忘れる Forgetting to persist the salt alongside the hash | ソルトを失うと同じ手順でハッシュを再現できず、全ユーザーがログイン不能になる Losing the salt makes the hash unreproducible, locking out every user | ソルトは秘密情報ではないため、ハッシュと同じレコード・同じ文字列に含めてよい(本ツールの形式のように) The salt isn't secret — store it with the hash, e.g. in one combined string as this tool does |
言語別コード例 / Code Examples
JavaScript (Web Crypto)
const enc = new TextEncoder();
const keyMaterial = await crypto.subtle.importKey(
"raw", enc.encode(password), "PBKDF2", false, ["deriveBits"]
);
const bits = await crypto.subtle.deriveBits(
{ name: "PBKDF2", salt: saltBytes, iterations: 210000, hash: "SHA-256" },
keyMaterial,
32 * 8
);Python
import hashlib, os, base64
salt = os.urandom(16)
dk = hashlib.pbkdf2_hmac("sha256", b"Hello", salt, 210000, dklen=32)
base64.b64encode(dk).decode()Node.js
const crypto = require("node:crypto");
crypto.pbkdf2("Hello", salt, 210000, 32, "sha256", (err, derivedKey) => {
console.log(derivedKey.toString("hex"));
});Go
import (
"golang.org/x/crypto/pbkdf2"
"crypto/sha256"
)
dk := pbkdf2.Key([]byte("Hello"), salt, 210000, 32, sha256.New)生成例 / Before & After
入力: password = "Hello"
salt (16バイト, hex) = 000102030405060708090a0b0c0d0e0f
iterations = 1000, algorithm = SHA-256
出力:
hex: 5adddb930b322a3f2da2e5577cba75ed2d36c54e9860699a1373a0b4fd3d6331
base64: Wt3bkwsyKj8touVXfLp17S02xU6YYGmaE3OgtP09YzE=
エンコード済み文字列:
pbkdf2-sha256$1000$AAECAwQFBgcICQoLDA0ODw==$Wt3bkwsyKj8touVXfLp17S02xU6YYGmaE3OgtP09YzE=Why browser-only?
A password is the single most sensitive string you will ever type. If a hash generator runs server-side, the password exists — even briefly — in someone else's logs, memory, and network path. This tool derives PBKDF2 hashes with crypto.subtle.deriveBits() entirely inside your browser: nothing is transmitted, nothing is stored, and the page works offline once loaded. Open DevTools, watch the Network tab, and generate or verify as many hashes as you like — zero requests. As a rule, use test values here rather than real, in-use production passwords.
パスワードは最も機密性の高い文字列です。本ツールは生成・検証の全てがブラウザ内のWeb Crypto APIで完結し、ネットワーク送信は一切発生しません。DevToolsのNetworkタブで実際に確認できます。念のため、本番で使用中のパスワードではなくテスト用の値を入力することを推奨します。 パスワード保存の設計全般についてはMD5とSHA-256の違い・パスワード保存の正解でも詳しく解説しています。
関連ガイド / Related Guides
関連ツール / Related Tools
開発をもっと効率的に
PR