DragonFly On-Line Manual Pages
MD5(1) DragonFly General Commands Manual MD5(1)
md5, sha1, sha256, sha512, rmd160 -- calculate a message-digest finger-
print (checksum) for a file
md5 [-pqrtx] [-b offset] [-e offset] [-s string] [file ...]
sha1 [-pqrtx] [-b offset] [-e offset] [-s string] [file ...]
sha256 [-pqrtx] [-b offset] [-e offset] [-s string] [file ...]
rmd160 [-pqrtx] [-b offset] [-e offset] [-s string] [file ...]
The md5, sha1, sha256, sha512 and rmd160 utilities take as input a mes-
sage of arbitrary length and produce as output a ``fingerprint'' or
``message digest'' of the input. It is conjectured that it is computa-
tionally infeasible to produce two messages having the same message
digest, or to produce any message having a given prespecified target mes-
sage digest. The MD5, SHA-1, SHA-256, SHA-512 and RIPEMD-160 algorithms
are intended for digital signature applications, where a large file must
be ``compressed'' in a secure manner before being encrypted with a pri-
vate (secret) key under a public-key cryptosystem such as RSA.
The MD5 and SHA-1 algorithms are vulnerable to practical collision
The following options may be used in any combination and must precede any
files named on the command line. The hexadecimal checksum of each file
listed on the command line is printed after the options are processed.
When processing file(s), use the specified begin and/or end
(below) instead of processing each file in its entirety. Either
option can be omitted. Both begin- and end-offsets can be speci-
fied as just a number (of bytes) or be followed by K, M, or G to
mean that the number is to be multiplied by 1024 once, twice, or
thrice respectively. For example, to start at 512, you can use
-b 512 or -b 0.5K.
The use of offsets is implemented using mmap() and will only work
on regular files and mmap-able devices.
If the beginning offset is negative, its absolute value is sub-
tracted from the file's size. Zero thus means the very beginning
of each file, which is also the default if the option is omitted
If the end-offset is not positive, its absolute value is sub-
tracted from the file's size. Zero thus means the very end of
each file, which is also the default if the option is omitted
Print a checksum of the given string.
-p Echo stdin to stdout and append the checksum to stdout.
-q Quiet mode -- only the checksum is printed out. Overrides the -r
-r Reverses the format of the output. This helps with visual diffs.
Does nothing when combined with the -ptx options.
-t Run a built-in time trial.
-x Run a built-in test script.
The md5, sha1, sha256, sha512 and rmd160 utilities exit 0 on success, and
EX_NOINPUT (66) if at least one of the input files could not be read or
invalid offsets were specified. A mistake with command line arguments
results in EX_USAGE (64).
cksum(1), mmap(2), md5(3), ripemd(3), sha(3), sha256(3), sha512(3)
R. Rivest, The MD5 Message-Digest Algorithm, RFC 1321.
J. Burrows, The Secure Hash Standard, FIPS PUB 180-1.
D. Eastlake and P. Jones, US Secure Hash Algorithm 1, RFC 3174.
RIPEMD-160 is part of the ISO draft standard "ISO/IEC DIS 10118-3" on
dedicated hash functions.
Secure Hash Standard (SHS):
The RIPEMD-160 page:
This program is placed in the public domain for free general use by RSA
Support for SHA-1 and RIPEMD-160 has been added by Oliver Eikemeier
DragonFly 5.5 December 17, 2017 DragonFly 5.5
DGST(1) OpenSSL DGST(1)
dgst, sha, sha1, mdc2, ripemd160, sha224, sha256, sha384, sha512, md2,
md4, md5, dss1 - message digests
[-c] [-d] [-hex] [-binary] [-r] [-non-fips-allow] [-out filename]
[-sign filename] [-keyform arg] [-passin arg] [-verify filename]
[-prverify filename] [-signature filename] [-hmac key]
[-non-fips-allow] [-fips-fingerprint] [file...]
openssl [digest] [...]
The digest functions output the message digest of a supplied file or
files in hexadecimal. The digest functions also generate and verify
digital signatures using message digests.
-c print out the digest in two digit groups separated by colons, only
relevant if hex format output is used.
-d print out BIO debugging information.
digest is to be output as a hex dump. This is the default case for
a "normal" digest as opposed to a digital signature. See NOTES
below for digital signatures using -hex.
output the digest or signature in binary form.
-r output the digest in the "coreutils" format used by programs like
Allow use of non FIPS digest when in FIPS mode. This has no effect
when not in FIPS mode.
filename to output to, or standard output by default.
digitally sign the digest using the private key in "filename".
Specifies the key format to sign digest with. The DER, PEM, P12,
and ENGINE formats are supported.
Use engine id for operations (including private key storage). This
engine is not used as source for digest algorithms, unless it is
also specified in the configuration file.
Pass options to the signature algorithm during sign or verify
operations. Names and values of these options are algorithm-
the private key password source. For more information about the
format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
verify the signature using the the public key in "filename". The
output is either "Verification OK" or "Verification Failure".
verify the signature using the the private key in "filename".
the actual signature to verify.
create a hashed MAC using "key".
create MAC (keyed Message Authentication Code). The most popular
MAC algorithm is HMAC (hash-based MAC), but there are other MAC
algorithms which are not based on hash, for instance gost-mac
algorithm, supported by ccgost engine. MAC keys and other options
should be set via -macopt parameter.
Passes options to MAC algorithm, specified by -mac key. Following
options are supported by both by HMAC and gost-mac:
Specifies MAC key as alphnumeric string (use if key contain
printable characters only). String length must conform to
any restrictions of the MAC algorithm for example exactly
32 chars for gost-mac.
Specifies MAC key in hexadecimal form (two hex digits per
byte). Key length must conform to any restrictions of the
MAC algorithm for example exactly 32 chars for gost-mac.
a file or files containing random data used to seed the random
number generator, or an EGD socket (see RAND_egd(3)). Multiple
files can be specified separated by a OS-dependent character. The
separator is ; for MS-Windows, , for OpenVMS, and : for all others.
enable use of non-FIPS algorithms such as MD5 even in FIPS mode.
compute HMAC using a specific key for certain OpenSSL-FIPS
file or files to digest. If no files are specified then standard
input is used.
To create a hex-encoded message digest of a file:
openssl dgst -md5 -hex file.txt
To sign a file using SHA-256 with binary file output:
openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt
To verify a signature:
openssl dgst -sha256 -verify publickey.pem \
-signature signature.sign \
The digest of choice for all new applications is SHA1. Other digests
are however still widely used.
When signing a file, dgst will automatically determine the algorithm
(RSA, ECC, etc) to use for signing based on the private key's ASN.1
info. When verifying signatures, it only handles the RSA, DSA, or
ECDSA signature itself, not the related data to identify the signer and
algorithm used in formats such as x.509, CMS, and S/MIME.
A source of random numbers is required for certain signing algorithms,
in particular ECDSA and DSA.
The signing and verify options should only be used if a single file is
being signed or verified.
Hex signatures cannot be verified using openssl. Instead, use "xxd -r"
or similar program to transform the hex signature into a binary
signature prior to verification.
1.0.2h 2016-05-03 DGST(1)