LinuxCommandLibrary

openssl-dgst

calculates message digests of files

TLDR

Calculate SHA256 hash
$ openssl dgst -sha256 [file]
copy
Calculate MD5 hash
$ openssl dgst -md5 [file]
copy
Output hash only
$ openssl dgst -sha256 -r [file]
copy
Sign file with private key
$ openssl dgst -sha256 -sign [private.key] -out [signature] [file]
copy
Verify signature
$ openssl dgst -sha256 -verify [public.key] -signature [signature] [file]
copy

SYNOPSIS

openssl dgst [options] [file...]

DESCRIPTION

openssl dgst calculates message digests (hashes) of files. Supports various algorithms including SHA-256, SHA-512, and MD5. Can also sign and verify files using asymmetric keys.

PARAMETERS

-sha256, -sha512, -md5

Hash algorithm to use.
-sign key
Sign with private key.
-verify key
Verify with public key.
-signature file
Signature file for verification.
-r
Output hash in coreutils format.
-hex
Output as hex (default).
-binary
Output in binary.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard