Where SHA-1 is used
- Git commit and object IDs
- Legacy HMAC-SHA1 APIs (still considered safe as an HMAC)
- Verifying old checksums
Command line
sha1sum file.txt shasum -a 1 file.txt # macOS echo -n "text" | sha1sum
In code
# Python
hashlib.sha1(b"text").hexdigest()
// Node.js
crypto.createHash('sha1').update('text').digest('hex')Hashing is deterministic and one-way: the same bytes always give the same 160-bit value, and a one-character change scrambles it completely — try the avalanche demo.