SHA-1 hash generator

Compute the SHA-1 digest of any text as you type, in hex or Base64, and compare it with a known value.

loading SHA-1 hash generator
About this tool

What is SHA-1?

SHA-1 produces a 160-bit digest (40 hex characters). It was the standard hash of TLS certificates and Git, until Google and CWI published two different PDFs with the same SHA-1 in 2017.

You still meet SHA-1 in Git commit ids, in older webhooks signed with HMAC-SHA1 and in TOTP authenticator codes, so computing it remains useful even though it is no longer secure.

This page opens the hash generator with SHA-1 on top and highlighted. The text is encoded as UTF-8 and hashed in your browser as you type; nothing is sent anywhere.

SHA-1 at a glance

SHA-1
Digest size160 bits (40 hex characters)
StandardFIPS 180-4
Published1995
Secure against attackersno: practical collisions since 2017 (SHAttered)
Where it is usedGit object ids, legacy checksums, HMAC-SHA1 in old APIs and TOTP codes
Good for passwordsno: use bcrypt or Argon2

How to generate a SHA-1 hash

  1. Type or paste the text in the input box.
  2. Read the SHA-1 row, at the top of the list; it updates as you type.
  3. To check a known SHA-1, paste it in the comparison field: the matching row lights up.

Example

SHA-1 of three inputs, computed by the same code as the tool:

InputSHA-1 (hex)
hello world2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
(empty text)da39a3ee5e6b4b0d3255bfef95601890afd80709
stdlib.toolsbd25a7fda2e37a198cf77f05ddaae5731e3912c3

A single invisible line break changes everything: hello world followed by a newline (what echo prints) gives 22596363b3de40b06f981fb85d82312e8c0ed511. When your value does not match, check trailing spaces and line breaks first.

SHA-1 in code

Node.js

import { createHash } from 'node:crypto';
createHash('sha1').update('hello world').digest('hex');

Python

import hashlib
hashlib.sha1(b"hello world").hexdigest()

Bash

printf 'hello world' | sha1sum

Frequently asked questions

Is SHA-1 still secure?

No: practical collisions since 2017 (SHAttered). Typical uses today: Git object ids, legacy checksums, HMAC-SHA1 in old APIs and TOTP codes.

How long is a SHA-1 hash?

160 bits: 40 hexadecimal characters, or 28 characters in Base64 (with padding), such as Kq5sNclPz7QV2+lfQIuc6R7oRu0= for hello world.

Why does my SHA-1 differ from another tool?

The input differs: a trailing newline, spaces or another text encoding (UTF-8 here). Hex is case-insensitive.

Report a problem