SHA-512ハッシュジェネレーター
任意のテキストからSHA-512ハッシュを生成
入力テキスト
SHA-512ハッシュ
SHA-512ハッシュがここに表示されます…
SHA-512ハッシュとは?
SHA-512は、NIST FIPS 180-4で定義されたSHA-2ファミリーの最大メンバーである暗号ハッシュ関数です。任意の長さの入力を受け取り、512ビット(64バイト)の固定長メッセージダイジェストを生成し、128桁の16進数文字列として表示されます。SHA-512は、デジタル署名(Ed25519は内部的にSHA-512を使用)、HMACの構築、ファイル整合性検証、広いセキュリティマージンを必要とする暗号プロトコルで使用されます。
SHA-512は、64ビットワード演算と80ラウンドの圧縮を使用して1024ビット(128バイト)ブロック単位で動作します。8つの初期ハッシュ値は最初の8つの素数の平方根の小数部から導出され、80個のラウンド定数は最初の80個の素数の立方根から導出されます。ネイティブ64ビット演算を使用するため、SHA-512は長いダイジェストを生成するにもかかわらず、現代の64ビットプロセッサ上ではSHA-256よりも高速なことがよくあります。
SHA-384、SHA-512/224、SHA-512/256はいずれもSHA-512の切り詰め変種であり、同じ内部構造を共有しますが、異なる初期ハッシュ値を使用し、出力ビット数が少なくなっています。SHA-2ファミリーが提供する最大ダイジェスト長が必要な場合、またはプロトコルがSHA-512を明示的に要求する場合(Ed25519やHMACベースの鍵導出スキームなど)、SHA-512が正しい選択です。SHA-512は256ビットの衝突耐性を提供しており、SHA-3-512と同等でSHA-256の128ビット境界を大幅に超えています。
オンラインSHA-512生成ツールを使う理由
SHA-512ハッシュの生成には通常、ターミナルコマンドかコードの記述が必要です。このブラウザベースのツールを使えば、何もインストールせず、ターミナルに切り替えることなく、使い捨てスクリプトを書くことなく、SHA-512ダイジェストを即座に生成できます。
SHA-512ハッシュジェネレーターの利用シーン
SHA-2ファミリー変種の比較
SHA-512はFIPS 180-4で定義されたSHA-2ファミリーに属しています。以下の表では、SHA-512の64ビット内部アーキテクチャを共有するSHA-2変種を、参照用のSHA-256とともに比較しています。
| 変種 | ダイジェストサイズ | 16進数の長さ | バイト数 | 主な用途 |
|---|---|---|---|---|
| SHA-256 | 256 bits | 64 hex chars | 32 bytes | TLS certificates, blockchain, JWTs, SRI |
| SHA-384 | 384 bits | 96 hex chars | 48 bytes | TLS 1.3 CertificateVerify, CNSA/Suite B |
| SHA-512 | 512 bits | 128 hex chars | 64 bytes | Digital signatures, HMAC, Ed25519, file integrity |
| SHA-512/224 | 224 bits | 56 hex chars | 28 bytes | SHA-512 speed on 64-bit CPUs, 224-bit output |
| SHA-512/256 | 256 bits | 64 hex chars | 32 bytes | SHA-512 speed on 64-bit CPUs, 256-bit output |
SHA-512 対 SHA-256 対 SHA-384 対 SHA-3-512
最適なハッシュアルゴリズムは、セキュリティ要件、性能制約、プロトコル仕様によって異なります。SHA-512はSHA-2ファミリー内で最も広いダイジェストを提供し、64ビットハードウェア上ではSHA-256より高速なことが多いです。この比較では、選択時に最も重要な特性を取り上げます。
| 特性 | SHA-512 | SHA-256 | SHA-384 | SHA-3-512 |
|---|---|---|---|---|
| Digest size | 512 bits (128 hex) | 256 bits (64 hex) | 384 bits (96 hex) | 512 bits (128 hex) |
| Block size | 1024 bits | 512 bits | 1024 bits | 1600 bits (sponge) |
| Word size | 64 bits | 32 bits | 64 bits | N/A (sponge) |
| Rounds | 80 | 64 | 80 | 24 |
| Collision resistance | 2^256 operations | 2^128 operations | 2^192 operations | 2^256 operations |
| Security status | Secure | Secure | Secure | Secure |
| Standard | FIPS 180-4 | FIPS 180-4 | FIPS 180-4 | FIPS 202 |
| Web Crypto API | Yes | Yes | Yes | No |
| 64-bit optimized | Yes | No (32-bit words) | Yes | Yes |
| Primary use today | Ed25519, HMAC, file checksums | TLS, blockchain, SRI | TLS 1.3, CNSA | Backup standard |
SHA-512の内部動作
SHA-512はMerkle–Damgård構造を使用して1024ビットブロック単位で入力を処理します。最初の8つの素数の平方根の小数部から導出された8つの64ビット状態ワード(H0〜H7)を初期化します。各ブロックは、64ビットワードに対するビット演算(AND、XOR、NOT、右回転、右シフト)と最初の80個の素数の立方根から導出された80個のラウンド定数を使用した80ラウンドの混合処理を経ます。
SHA-512: 309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f
989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f
(512 bits = 64 bytes = 128 hex characters)
| ステップ | 説明 |
|---|---|
| Padding | Append a 1-bit, then zeros until the message length is 896 mod 1024. Append the original length as a 128-bit big-endian integer. |
| Block splitting | Divide the padded message into 1024-bit (128-byte) blocks. |
| Message schedule | Expand each 16-word (64-bit) block into 80 words using sigma functions with right-rotate and right-shift operations on 64-bit values. |
| Compression | Process 80 rounds per block using Ch, Maj, and two Sigma functions with 80 round constants derived from the cube roots of the first 80 primes. |
| Output | Concatenate the eight 64-bit state words (H0–H7) into a 512-bit (64-byte) digest, rendered as 128 hexadecimal characters. |
64ビットワードサイズがSHA-256との主な差別化要因です。64ビットCPUでは、各演算がサイクルあたり2倍のビットを処理するため、64ラウンドではなく80ラウンドを実行するにもかかわらず、ベンチマークではSHA-512がSHA-256を上回ることが多い理由です。アバランシェ効果により、入力の1ビットを反転させると512の出力ビットの約50%が変化します。
SHA-512コードサンプル
SHA-512はすべての主要な言語とランタイムでネイティブにサポートされています。Web Crypto APIはライブラリなしでブラウザ上でも提供されています。以下はUnicode処理やファイルハッシュを含む一般的なパターンをカバーしたサンプルです。
// Works in all modern browsers and Node.js 18+
async function sha512(text) {
const data = new TextEncoder().encode(text)
const hashBuffer = await crypto.subtle.digest('SHA-512', data)
const hashArray = Array.from(new Uint8Array(hashBuffer))
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('')
}
await sha512('hello world')
// → "309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f"
// Node.js (built-in crypto module)
const crypto = require('crypto')
crypto.createHash('sha512').update('hello world').digest('hex')
// → "309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f"import hashlib
# Basic SHA-512 hash
result = hashlib.sha512(b'hello world').hexdigest()
print(result)
# → "309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee..."
# Hash a string with Unicode (encode to bytes first)
text = 'café ☕'
hashlib.sha512(text.encode('utf-8')).hexdigest()
# → 128-character hex string
# Hash a large file in chunks (memory-efficient)
with open('release.tar.gz', 'rb') as f:
sha = hashlib.sha512()
for chunk in iter(lambda: f.read(8192), b''):
sha.update(chunk)
print(sha.hexdigest())package main
import (
"crypto/sha512"
"fmt"
)
func main() {
data := []byte("hello world")
hash := sha512.Sum512(data)
fmt.Printf("%x\n", hash)
// → 309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f...
}# Using sha512sum (Linux) or shasum (macOS) echo -n "hello world" | sha512sum # → 309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee... - # macOS echo -n "hello world" | shasum -a 512 # → 309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee... - # Verify a file checksum echo "309ecc48... myfile.bin" | sha512sum -c # → myfile.bin: OK # Using openssl (cross-platform) echo -n "hello world" | openssl dgst -sha512 # → SHA2-512(stdin)= 309ecc489c12d6eb4cc40f50c902f2b4...