{
    "content": [
        {
            "type": "text",
            "text": "# openssl-dgst (info)\n\n## NAME\n\nopenssl-dgst - perform digest operations\n\n## SYNOPSIS\n\nopenssl dgst|digest [-digest] [-list] [-help] [-c] [-d] [-debug] [-hex]\n[-binary] [-xoflen length] [-r] [-out filename] [-sign filename|uri]\n[-keyform DER|PEM|P12|ENGINE] [-passin arg] [-verify filename]\n[-prverify filename] [-signature filename] [-sigopt nm:v] [-hmac key]\n[-mac alg] [-macopt nm:v] [-fips-fingerprint] [-engine id]\n[-engineimpl id] [-rand files] [-writerand file] [-provider name]\n[-provider-path path] [-propquery propq] [file ...]\n\n## DESCRIPTION\n\nThis command output the message digest of a supplied file or files in\nhexadecimal, and also generates and verifies digital signatures using\nmessage digests.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (7 subsections)\n- **EXAMPLES**\n- **NOTES**\n- **SEE ALSO**\n- **HISTORY**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "openssl-dgst",
        "section": "",
        "mode": "info",
        "summary": "openssl-dgst - perform digest operations",
        "synopsis": "openssl dgst|digest [-digest] [-list] [-help] [-c] [-d] [-debug] [-hex]\n[-binary] [-xoflen length] [-r] [-out filename] [-sign filename|uri]\n[-keyform DER|PEM|P12|ENGINE] [-passin arg] [-verify filename]\n[-prverify filename] [-signature filename] [-sigopt nm:v] [-hmac key]\n[-mac alg] [-macopt nm:v] [-fips-fingerprint] [-engine id]\n[-engineimpl id] [-rand files] [-writerand file] [-provider name]\n[-provider-path path] [-propquery propq] [file ...]",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Print out a usage message."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Specifies name of a supported digest to be used. See option -list below :"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Prints out a list of supported message digests. -c Print out the digest in two digit groups separated by colons, only relevant if the -hex option is given as well."
            },
            {
                "flag": "-d",
                "long": null,
                "arg": null,
                "description": "Print out BIO debugging information."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Output the digest or signature in binary form. -xoflen length Set the output length for XOF algorithms, such as shake128. -r Output the digest in the \"coreutils\" format, including newlines. Used by programs like sha1sum(1). -out filename Filename to output to, or standard output by default. -sign filename|uri Digitally sign the digest using the given private key. Note this option does not support Ed25519 or Ed448 private keys. Use the openssl-pkeyutl(1) command instead for this. -keyform DER|PEM|P12|ENGINE The format of the key to sign with; unspecified by default. See openssl-format-options(1) for details. -sigopt nm:v Pass options to the signature algorithm during sign or verify operations. Names and values of these options are algorithm- specific. -passin arg The private key password source. For more information about the format of arg see openssl-passphrase-options(1). -verify filename Verify the signature using the public key in \"filename\". The output is either \"Verified OK\" or \"Verification Failure\". -prverify filename Verify the signature using the private key in \"filename\". -signature filename The actual signature to verify. -hmac key Create a hashed MAC using \"key\". The openssl-mac(1) command should be preferred to using this command line option. -mac alg 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 the gost engine. MAC keys and other options should be set via -macopt parameter. The openssl-mac(1) command should be preferred to using this command line option. -macopt nm:v Passes options to MAC algorithm, specified by -mac key. Following options are supported by both by HMAC and gost-mac: key:string Specifies MAC key as alphanumeric 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. hexkey:string 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. The openssl-mac(1) command should be preferred to using this command line option."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Compute HMAC using a specific key for certain OpenSSL-FIPS operations. -rand files, -writerand file See \"Random State Options\" in openssl(1) for details. -engine id See \"Engine Options\" in openssl(1). This option is deprecated. The engine is not used for digests unless the -engineimpl option is used or it is configured to do so, see \"Engine Configuration Module\" in config(5). -engineimpl id When used with the -engine option, it specifies to also use engine id for digest operations. -provider name -provider-path path -propquery propq See \"Provider Options\" in openssl(1), provider(7), and property(7). file ... File or files to digest. If no files are specified then standard input is used."
            }
        ],
        "examples": [
            "To create a hex-encoded message digest of a file:",
            "openssl dgst -md5 -hex file.txt",
            "or",
            "openssl md5 file.txt",
            "To sign a file using SHA-256 with binary file output:",
            "openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt",
            "or",
            "openssl sha256 -sign privatekey.pem -out signature.sign file.txt",
            "To verify a signature:",
            "openssl dgst -sha256 -verify publickey.pem \\",
            "-signature signature.sign \\",
            "file.txt"
        ],
        "see_also": [
            {
                "name": "openssl-mac",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-mac/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-help",
                        "lines": 2
                    },
                    {
                        "name": "-digest",
                        "lines": 3
                    },
                    {
                        "name": "-list",
                        "lines": 5
                    },
                    {
                        "name": "-d, -debug",
                        "lines": 2,
                        "flag": "-d"
                    },
                    {
                        "name": "-hex",
                        "lines": 4
                    },
                    {
                        "name": "-binary",
                        "lines": 73
                    },
                    {
                        "name": "-fips-fingerprint",
                        "lines": 26
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 18,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 8,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "openssl-dgst - perform digest operations\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "openssl dgst|digest [-digest] [-list] [-help] [-c] [-d] [-debug] [-hex]\n[-binary] [-xoflen length] [-r] [-out filename] [-sign filename|uri]\n[-keyform DER|PEM|P12|ENGINE] [-passin arg] [-verify filename]\n[-prverify filename] [-signature filename] [-sigopt nm:v] [-hmac key]\n[-mac alg] [-macopt nm:v] [-fips-fingerprint] [-engine id]\n[-engineimpl id] [-rand files] [-writerand file] [-provider name]\n[-provider-path path] [-propquery propq] [file ...]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This command output the message digest of a supplied file or files in\nhexadecimal, and also generates and verifies digital signatures using\nmessage digests.\n\nThe generic name, openssl dgst, may be used with an option specifying\nthe algorithm to be used.  The default digest is sha256.  A supported\ndigest name may also be used as the sub-command name.  To see the list\nof supported algorithms, use \"openssl list -digest-algorithms\"\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-help",
                        "content": "Print out a usage message.\n"
                    },
                    {
                        "name": "-digest",
                        "content": "Specifies name of a supported digest to be used. See option -list\nbelow :\n"
                    },
                    {
                        "name": "-list",
                        "content": "Prints out a list of supported message digests.\n\n-c  Print out the digest in two digit groups separated by colons, only\nrelevant if the -hex option is given as well.\n"
                    },
                    {
                        "name": "-d, -debug",
                        "content": "Print out BIO debugging information.\n",
                        "flag": "-d"
                    },
                    {
                        "name": "-hex",
                        "content": "Digest is to be output as a hex dump. This is the default case for\na \"normal\" digest as opposed to a digital signature.  See NOTES\nbelow for digital signatures using -hex.\n"
                    },
                    {
                        "name": "-binary",
                        "content": "Output the digest or signature in binary form.\n\n-xoflen length\nSet the output length for XOF algorithms, such as shake128.\n\n-r  Output the digest in the \"coreutils\" format, including newlines.\nUsed by programs like sha1sum(1).\n\n-out filename\nFilename to output to, or standard output by default.\n\n-sign filename|uri\nDigitally sign the digest using the given private key. Note this\noption does not support Ed25519 or Ed448 private keys. Use the\nopenssl-pkeyutl(1) command instead for this.\n\n-keyform DER|PEM|P12|ENGINE\nThe format of the key to sign with; unspecified by default.  See\nopenssl-format-options(1) for details.\n\n-sigopt nm:v\nPass options to the signature algorithm during sign or verify\noperations.  Names and values of these options are algorithm-\nspecific.\n\n-passin arg\nThe private key password source. For more information about the\nformat of arg see openssl-passphrase-options(1).\n\n-verify filename\nVerify the signature using the public key in \"filename\".  The\noutput is either \"Verified OK\" or \"Verification Failure\".\n\n-prverify filename\nVerify the signature using the private key in \"filename\".\n\n-signature filename\nThe actual signature to verify.\n\n-hmac key\nCreate a hashed MAC using \"key\".\n\nThe openssl-mac(1) command should be preferred to using this\ncommand line option.\n\n-mac alg\nCreate MAC (keyed Message Authentication Code). The most popular\nMAC algorithm is HMAC (hash-based MAC), but there are other MAC\nalgorithms which are not based on hash, for instance gost-mac\nalgorithm, supported by the gost engine. MAC keys and other options\nshould be set via -macopt parameter.\n\nThe openssl-mac(1) command should be preferred to using this\ncommand line option.\n\n-macopt nm:v\nPasses options to MAC algorithm, specified by -mac key.  Following\noptions are supported by both by HMAC and gost-mac:\n\nkey:string\nSpecifies MAC key as alphanumeric string (use if key contain\nprintable characters only). String length must conform to any\nrestrictions of the MAC algorithm for example exactly 32 chars\nfor gost-mac.\n\nhexkey:string\nSpecifies MAC key in hexadecimal form (two hex digits per\nbyte).  Key length must conform to any restrictions of the MAC\nalgorithm for example exactly 32 chars for gost-mac.\n\nThe openssl-mac(1) command should be preferred to using this\ncommand line option.\n"
                    },
                    {
                        "name": "-fips-fingerprint",
                        "content": "Compute HMAC using a specific key for certain OpenSSL-FIPS\noperations.\n\n-rand files, -writerand file\nSee \"Random State Options\" in openssl(1) for details.\n\n-engine id\nSee \"Engine Options\" in openssl(1).  This option is deprecated.\n\nThe engine is not used for digests unless the -engineimpl option\nis used or it is configured to do so, see \"Engine Configuration\nModule\" in config(5).\n\n-engineimpl id\nWhen used with the -engine option, it specifies to also use engine\nid for digest operations.\n\n-provider name\n-provider-path path\n-propquery propq\nSee \"Provider Options\" in openssl(1), provider(7), and property(7).\n\nfile ...\nFile or files to digest. If no files are specified then standard\ninput is used.\n"
                    }
                ]
            },
            "EXAMPLES": {
                "content": "To create a hex-encoded message digest of a file:\n\nopenssl dgst -md5 -hex file.txt\nor\nopenssl md5 file.txt\n\nTo sign a file using SHA-256 with binary file output:\n\nopenssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt\nor\nopenssl sha256 -sign privatekey.pem -out signature.sign file.txt\n\nTo verify a signature:\n\nopenssl dgst -sha256 -verify publickey.pem \\\n-signature signature.sign \\\nfile.txt\n",
                "subsections": []
            },
            "NOTES": {
                "content": "The digest mechanisms that are available will depend on the options\nused when building OpenSSL.  The \"openssl list -digest-algorithms\"\ncommand can be used to list them.\n\nNew or agile applications should use probably use SHA-256. Other\ndigests, particularly SHA-1 and MD5, are still widely used for\ninteroperating with existing formats and protocols.\n\nWhen signing a file, this command will automatically determine the\nalgorithm (RSA, ECC, etc) to use for signing based on the private key's\nASN.1 info.  When verifying signatures, it only handles the RSA, DSA,\nor ECDSA signature itself, not the related data to identify the signer\nand algorithm used in formats such as x.509, CMS, and S/MIME.\n\nA source of random numbers is required for certain signing algorithms,\nin particular ECDSA and DSA.\n\nThe signing and verify options should only be used if a single file is\nbeing signed or verified.\n\nHex signatures cannot be verified using openssl.  Instead, use \"xxd -r\"\nor similar program to transform the hex signature into a binary\nsignature prior to verification.\n\nThe openssl-mac(1) command is preferred over the -hmac, -mac and\n-macopt command line options.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "openssl-mac(1)\n",
                "subsections": []
            },
            "HISTORY": {
                "content": "The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0.\nThe FIPS-related options were removed in OpenSSL 1.1.0.\n\nThe -engine and -engineimpl options were deprecated in OpenSSL 3.0.\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.\n\nLicensed under the Apache License 2.0 (the \"License\").  You may not use\nthis file except in compliance with the License.  You can obtain a copy\nin the file LICENSE in the source distribution or at\n<https://www.openssl.org/source/license.html>.\n\n3.0.2                             2026-06-02                OPENSSL-DGST(1SSL)",
                "subsections": []
            }
        }
    }
}