Skip to content

↑↓ navigate ↵ open Esc close Search runs locally

SHA-1 Hash Generator (Text & Files)

Generate the SHA-1 hash of text or a file and verify SHA-1 checksums. SHA-1 is no longer safe against attackers, but it is still found in Git and many older systems.

  • Runs in your browser
  • Nothing is uploaded
  • Free, no sign-up
Algorithms
0 BUTF-8
Hashes

    Runs in your browser. Files are never uploaded. Tip: drop a file to verify a download

    How to use the SHA-1 tool#

    1. Type or paste text, or drop a file onto the left box.
    2. The 40-character SHA-1 hash appears on the right. Choose Hex or Base64 under Format.
    3. Paste an expected value into Compare with a checksum to check a file.
    4. For anything security-related, also select SHA-256 in the top bar and use that value instead.

    Examples#

    SHA-1 of a word

    Input
    hello
    Output
    aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d

    Always 40 hex characters (160 bits).

    The classic test sentence

    Input
    The quick brown fox jumps over the lazy dog
    Output
    2fd4e1c67a2d28fced849ee1bb76e7391b93eb12

    A standard test vector used by many libraries.

    SHA-1 of an empty string

    Input
    Output
    da39a3ee5e6b4b0d3255bfef95601890afd80709

    This value often appears in logs when something hashed empty input.

    What is SHA-1?#

    SHA-1 (Secure Hash Algorithm 1) turns any input into a 160-bit hash, written as 40 hexadecimal characters. It was published by NIST in 1995 and was the standard secure hash for over a decade, used in TLS certificates, PGP, SSH and code signing.

    Is SHA-1 still secure?#

    No. In 2017, Google and CWI Amsterdam published SHAttered: two different PDF files with the same SHA-1 hash. In 2020, a "chosen-prefix" collision made attacks practical for real formats. Browsers stopped trusting SHA-1 certificates in 2017, and NIST has scheduled SHA-1 to be retired completely by 2030.

    UseSHA-1 OK?
    Detecting accidental corruptionYes
    Identifying objects in an existing Git repositoryYes (Git adds collision detection)
    Signatures, certificates, verifying downloads against tamperingNo: use SHA-256
    PasswordsNever

    SHA-1 in Git#

    Every Git commit, tree and file is identified by a SHA-1 hash, which is why commit IDs are 40 characters long (or a short prefix such as 2fd4e1c). Since SHAttered, Git uses a hardened SHA-1 that detects the known collision attack, and newer versions can create repositories with SHA-256 object IDs (git init --object-format=sha256).

    Note that Git does not hash the raw file: it hashes blob <size>\0 followed by the content, so git hash-object gives a different value from a plain SHA-1 of the same file.

    SHA-1 in code#

    bash
    echo -n 'hello' | sha1sum     # Linuxshasum -a 1 file.zip          # macOS
    php
    sha1('hello');               // "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d"sha1_file('file.zip');
    python
    import hashlibhashlib.sha1(b'hello').hexdigest()
    javascript
    // Browserconst hash = await crypto.subtle.digest('SHA-1', new TextEncoder().encode('hello'));

    Common errors and fixes#

    • My SHA-1 differs from git hash-object

      Git hashes a header (blob <size>\0) plus the content, not the content alone. Both values are correct for what they hash.

    • My SHA-1 differs from the terminal

      echo adds a newline. Use echo -n or printf to hash exactly the text.

    • A tool or browser warns that SHA-1 is insecure

      That is expected for signatures and certificates. Switch those to SHA-256; plain checksums for corruption are still fine.

    Frequently asked questions#

    How long is a SHA-1 hash?

    160 bits: 40 hexadecimal characters, or 28 characters in Base64.

    Is SHA-1 broken?

    Yes, for collision resistance: two different files with the same SHA-1 can be created. It still detects accidental changes.

    What should I use instead of SHA-1?

    SHA-256 for checksums and signatures, SHA-3 or BLAKE3 as modern alternatives, and bcrypt or Argon2 for passwords.

    Is my file uploaded?

    No. The hash is calculated in your browser.

    Your next tool is one search away.

    Free, private developer tools that run in your browser. No signup, nothing uploaded, no waiting.

    Browse all tools

    Tip: press Ctrl D to bookmark dev247.