SHA1 Hash

InputCharacter 0 0 Bytes
示例:
All Hashes (side-by-side)
Computed via Web Crypto API
MD5
32 hex
SHA-1
40 hex
SHA-256
64 hex
SHA-384
96 hex
SHA-512
128 hex

Online SHA1 hash generator that instantly produces a 40-character hexadecimal digest from any text input. Supports text and file hashing with local browser processing to protect your privacy.

Related

What is SHA1?

SHA1 (Secure Hash Algorithm 1) is a cryptographic hash function designed by the U.S. National Security Agency (NSA) and published by NIST in 1995. It accepts input of any length and produces a 160-bit (40 hexadecimal character) output.

**Typical uses:** ①Git/SVN commit fingerprints (commit SHA); ②File integrity checks (legacy compatibility); ③Software distribution hashes (largely replaced by SHA-256); ④TLS 1.0/1.1 handshakes (deprecated).

**Security status:** In 2017, Google and CWI Amsterdam publicly demonstrated the first practical SHA-1 collision attack (SHAttered), proving SHA-1 is no longer collision-resistant. Use SHA-256 or higher for security-sensitive scenarios; SHA-1 remains acceptable for non-security uses like Git history and file fingerprints.

**Comparison with MD5:** SHA1 is slightly more secure than MD5 (longer output), but neither is collision-resistant today. MD5 is still fast for file fingerprinting and deduplication; SHA1 persists in Git history. Neither should be used for new security-critical applications.

Use Cases

  • Looking up Git commit hashes
  • SVN code version fingerprinting
  • SHA1 verification on legacy systems (avoiding migration)
  • Demonstrating cryptographic hashing in education or research
  • Verifying checksums on older software distributed with MD5/SHA1
  • Testing client/server SHA1 implementation consistency

How to Use

  1. Type or paste text into the input field
  2. The tool automatically computes SHA1 and displays the 40-character hex result
  3. Optional: drag and drop a file to compute its file SHA1
  4. Click the copy button to copy the hash digest

Features

  • Text SHA1: real-time calculation in milliseconds
  • File SHA1: chunked processing supports large files
  • Local browser processing: your data never leaves your device
  • One-click copy: copy the hash digest to your clipboard
  • Supports Unicode, Emoji, and multi-language text
  • Compare two SHA1 hashes (case-insensitive comparison)

FAQ

Is SHA1 secure? Can I still use it?

Use SHA-256/SHA-512 or higher for security-sensitive scenarios. SHA-1 was practically broken by Google's 2017 SHAttered collision attack. However: ①Git history compatibility; ②Legacy software verification; ③Non-sensitive file fingerprints—these uses remain acceptable.

What is the output length of SHA1?

SHA1 produces a 160-bit output, displayed as 40 hexadecimal characters (each hex character represents 4 bits). For example: a1b2c3d4e5f6... totaling 40 characters.

Which is better: SHA1 or MD5?

Neither is suitable for new security applications. SHA1 is marginally more secure than MD5 due to its longer output. In practice: ①Use MD5 for fast file fingerprinting/deduplication; ②Use SHA1 for Git compatibility; ③Use SHA-256+ for security.

Is SHA1 case-sensitive?

Yes—input text with different capitalization will produce completely different hashes. The hash digest string itself can be displayed in uppercase or lowercase (Linux convention is lowercase, Windows is uppercase); comparisons should be case-insensitive.

Can I compute the SHA1 hash of a file?

Yes. Click the "Upload File" button or drag and drop a file onto the page. The tool uses chunked processing to calculate file SHA1, which works smoothly even with large files.

Is SHA1 an encryption algorithm?

No. SHA1 is a one-way hash function; you cannot practically reverse a hash back to its original input. "SHA1 encryption" is a common misnomer. This tool performs hashing, not encryption.

Why does Git still use SHA1?

Although SHA1 itself is not collision-resistant, Git uses SHA1 within collision-mitigating structures specifically designed by Linus Torvalds. Even if raw collisions can be generated, constructing a colliding Git commit with the same prefix is not currently feasible, so Git remains safe.

Is my uploaded content sent to a server?

No. This tool uses the Web Crypto API to compute hashes entirely within your browser. Your data is never uploaded to any server. Local processing protects your privacy, making it suitable for sensitive content.

Troubleshooting

My SHA1 output doesn't match what another tool shows

Check: 1) Did you enter exactly the same text (including spaces, newlines, and invisible characters)? 2) Was whitespace automatically trimmed (try enabling the "Include newlines" option)? 3) Is the character encoding consistent (UTF-8 vs other encodings)?

My SHA1 output is not 40 characters long

SHA1 always produces 160 bits = 40 hexadecimal characters. If your output is longer or shorter, the tool may be displaying it in Base64 encoding. Confirm that the tool is using hexadecimal output rather than another encoding format.

Glossary

SHA1
A 160-bit cryptographic hash function standardized by NIST in FIPS 180-1. No longer collision-resistant, but still commonly used for Git history and legacy file verification.
Hash (Digest)
A mathematical function that maps arbitrary-length input to fixed-length output. This tool produces a 40-character hexadecimal SHA1 digest.
Collision
When two different inputs produce the same hash value. The 2017 SHAttered attack by Google demonstrated that SHA1 collisions can be constructed.
FIPS
Federal Information Processing Standards, U.S. government standards issued by NIST. FIPS 180-1 is the standard that defines SHA1.
Hex Encoding
Hash values are typically displayed in hexadecimal, where each 4 bits of binary maps to one hex character. SHA1 outputs 160 bits = 40 hex characters.
Git Commit Hash
Git uses SHA1 to identify every commit. Although the algorithm itself is broken, Git remains safe because Linus Torvalds designed collision-mitigating structures around SHA1.

SHA1 vs Other Hash Algorithms

Compare SHA1 with MD5 and the SHA-2 family.

AlgorithmOutputPublishedSecurity
MD5128-bit / 32 chars1992Weak (broken 2004)
SHA-1160-bit / 40 chars1995Weak (broken 2017)
SHA-256256-bit / 64 chars2001Strong (recommended)
SHA-512512-bit / 128 chars2001Very strong

SHA1 Performance by Input Size

SHA1 processing time scales linearly with input data size.

Input SizeLocal Processing TimeTypical Use
10 chars< 1 msShort string
1 KB< 1 msShort text document
100 KB1-2 msMedium document
10 MB30-60 msPDF file
100 MB300-600 msVideo file
1 GB3-6 sLarge file

5 Common SHA1 Use Cases with Risk Levels

Covering development, version control, compliance, and security.

Use CaseRisk LevelCore Value
Git commit hashesLow (Git collision protection)Legacy compatibility
Legacy software SHA1 checksumsMediumBackward compatibility
Educational demosNoneLearning hash principles
Password hashingHigh (do not use)Use bcrypt/Argon2 instead
API signaturesHigh (do not use)Use SHA256/HMAC-SHA256 instead

Authoritative References