Bash

Hash File (SHA-256)

admin by @admin ADMIN
Jun 20, 2026
May 31, 2026
Public
0 0 up · 0 down Sign in to vote
Compute and verify file checksums for downloads, backups, and integrity audits. sha256sum on Linux; shasum -a 256 on macOS.
Bash
Raw
# Compute SHA-256 of a file (Linux)
sha256sum big-file.zip
# 3a7bd3e2360a3d... big-file.zip

# macOS / BSD equivalent
shasum -a 256 big-file.zip

# Verify a checksum
echo "3a7bd3e2360a3d...  big-file.zip" | sha256sum -c
# big-file.zip: OK

# Hash a string (no temp file)
echo -n "hello world" | sha256sum
echo -n "hello world" | openssl dgst -sha256

# Different algorithms
md5sum file                     # weak — use only for non-security checks
sha1sum file                    # also weak
sha256sum file                  # the default safe choice
sha512sum file                  # more output, similar security
Tags

Save your own code snippets

Create a free account and build your private vault. Share publicly whenever you want.