Skip to content
uencoder

SHA-1

SHA-1 is a 160-bit cryptographic hash function designed by the NSA; Google published the SHAttered collision in 2017, and it has been deprecated across standards.

Purpose

Provides a 160-bit message digest; once used for TLS certificates and Git, deprecated due to collision attacks.

Mechanism

Processes input in 512-bit blocks, maintaining a 160-bit state (five 32-bit words). Each block goes through 80 steps of nonlinear transforms updating the state. The 2017 SHAttered attack constructs a collision at about 2^63 complexity.

Use cases

  • Git object hashing (migrating to SHA-256)
  • HMAC-SHA1 (still secure)
  • Legacy digital certificates
  • Teaching examples

Examples

  • Input
    hello
    Output
    aaf4c61ddcc5e8a2dabeede0f3bde2d0d4b2f2

    160 bits = 40 hex characters

Common errors

Using SHA-1 for signatures in new systems
Use SHA-256 or SHA-3

Related terms

Related tools

References