DevToolBox

Hash Generator

MD5、SHA-1、SHA-256ハッシュをブラウザ上で即座に生成します。

How to Use the Hash Generator

This free online hash generator lets you create MD5, SHA-1, and SHA-256 hashes from any text input. Simply type or paste your text into the input field and click "Generate Hashes" to see all three hash values at once. Each hash can be copied to your clipboard with a single click. All computation is performed entirely in your browser using the Web Crypto API, so your data never leaves your device.

What Are Hash Functions?

A cryptographic hash function takes an input of any length and produces a fixed-length string of characters. The output, called a hash or digest, is deterministic (the same input always produces the same output) and designed to be a one-way function (it is computationally infeasible to reverse the hash back to the original input). Even a tiny change in the input produces a completely different hash, a property known as the avalanche effect.

Understanding MD5, SHA-1, and SHA-256

MD5 produces a 128-bit (32 hex character) hash. It is fast but considered cryptographically broken due to collision vulnerabilities. It remains useful for checksums and non-security purposes like verifying file integrity. SHA-1 produces a 160-bit (40 hex character) hash. While stronger than MD5, it has also been found vulnerable to collision attacks and is being phased out of security-sensitive applications. SHA-256 is part of the SHA-2 family and produces a 256-bit (64 hex character) hash. It is currently considered secure and is widely used in SSL certificates, blockchain technology, and password hashing.

Common Use Cases

Hash functions are used for verifying file integrity after downloads, storing passwords securely (when combined with salting), generating unique identifiers for data, digital signatures and certificate validation, and blockchain proof-of-work systems. Developers frequently use hash generators to verify checksums, compare data integrity, and debug hashing implementations in their applications.

ハッシュ生成ツールについて

テキストからMD5、SHA-1、SHA-256の各ハッシュ値をブラウザ上で即座に生成できるツールです。Web Crypto APIを使用し、データがサーバーに送信されることはありません。ファイル整合性の確認やチェックサムの検証などに便利です。

実務での活用例

  • ダウンロードファイルの検証 -- 配布元が公開する SHA-256 チェックサムと突き合わせて改ざん・破損を検出
  • キャッシュキー・重複検出 -- 同じ入力は常に同じハッシュになる性質を利用して、コンテンツの同一性を高速判定
  • Webhook 署名の検証デバッグ -- 期待値と実際のペイロードのハッシュを比較して署名不一致の原因を切り分け

よくある落とし穴と対処 / Common Pitfalls

落とし穴 / Pitfall問題 / Problem対処 / Fix
パスワード保存に MD5/SHA-256 を使う
Hashing passwords with MD5/SHA-256
高速なハッシュは GPU 総当たりに弱く、パスワード保存には不適
Fast hashes are trivially brute-forced on GPUs
bcrypt / scrypt / Argon2id などの低速・ソルト付きアルゴリズムを使う
Use bcrypt / scrypt / Argon2id with salts
MD5・SHA-1 を署名用途に使う
Using MD5/SHA-1 for signatures
どちらも衝突攻撃が実証済みで暗号用途では破られている
Both have practical collision attacks
SHA-256 以上を使用。MD5 は非セキュリティ用途のチェックサム限定
Use SHA-256+; keep MD5 for non-security checksums only
同じ文字列なのにハッシュが違う
Same text, different hash
末尾の改行・空白、改行コード(CRLF/LF)、Unicode正規化(NFC/NFD)の差
Trailing whitespace, CRLF vs LF, or NFC/NFD differences
ハッシュ前に trim・改行統一・normalize("NFC") で正規化
Trim, unify newlines, and normalize before hashing
「ハッシュ=暗号化」と誤解
Confusing hashing with encryption
ハッシュは一方向で復号は不可能。可逆性が必要な場面で使えない
Hashes are one-way; you cannot decrypt them
復元が必要なら暗号化(AES-GCM等)、検証だけならハッシュと使い分け
Encrypt when you need the data back; hash when you only verify
ハッシュの大文字小文字不一致
Case mismatch when comparing hashes
16進表記は大小どちらもあり、文字列比較で false になる
Hex digests appear in both cases; naive comparison fails
比較前に両辺を小文字へ統一する
Lowercase both sides before comparing

言語別コード例 / Code Examples

JavaScript (Web Crypto)

const data = new TextEncoder().encode("Hello");
const buf = await crypto.subtle.digest("SHA-256", data);
const hex = [...new Uint8Array(buf)].map((b) => b.toString(16).padStart(2, "0")).join("");

Python

import hashlib
hashlib.sha256("Hello".encode()).hexdigest()
hashlib.md5(b"Hello").hexdigest()  # チェックサム用途のみ

Shell

echo -n "Hello" | sha256sum    # -n を忘れると改行込みで別のハッシュに
sha256sum downloaded.iso       # ファイルの検証

Go

import ("crypto/sha256"; "encoding/hex")
sum := sha256.Sum256([]byte("Hello"))
hex.EncodeToString(sum[:])

ハッシュ値の例 / Before & After

入力: "Hello"
MD5:     8b1a9953c4611296a827abf8c47804d7  (32桁)
SHA-1:   f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0  (40桁)
SHA-256: 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969  (64桁)

入力: "Hello!"(1文字追加)
SHA-256: 334d016f755cd6dc58c53a86e183882f8ec14f52fb05345887c8a5edd42c87b7
→ 1文字の違いで全体が完全に変化(雪崩効果)

Why browser-only?

The strings you hash are often the ones you least want to share: API payloads, tokens, internal identifiers, or text you are about to sign. This tool computes MD5, SHA-1 and SHA-256 with the Web Crypto API (and a local MD5 implementation) entirely in your browser — no input ever leaves your device, nothing is logged, and it works offline. Open the DevTools Network tab and hash away: zero requests.

ハッシュ化する文字列はトークンや署名対象データなど機密であることが多いもの。 本ツールは計算の全てがブラウザ内で完結し、入力が外部に送信されることはありません。 パスワード保存の正しい方法はMD5とSHA-256の違い・パスワード保存の正解で詳しく解説しています。

関連ガイド / Related Guides

開発をもっと効率的に

PR