openssl-dgst:tldr:ab8cd
openssl-dgst: Calculate the SHA256 digest for a file, saving the result to a specific file.
$ openssl dgst -sha256 -binary -out ${output_file} ${input_file}
try on your machine
This command uses the "openssl" utility to calculate the SHA-256 hash of a file.
Here's a breakdown of the command:
- "openssl dgst": This is the main command for running OpenSSL's hashing functions.
- "-sha256": Specifies that the hash algorithm to be used is SHA-256, which stands for Secure Hash Algorithm 256-bit.
- "-binary": This option tells OpenSSL to output the result in binary format, rather than the default hexadecimal format.
- "-out ${output_file}": Specifies the output file where the resulting hash will be saved. "${output_file}" is a placeholder that should be replaced with the desired path and filename.
- "${input_file}": Specifies the input file for which we want to calculate the hash. "${input_file}" is a placeholder that should be replaced with the path and filename of the desired file.
To use this command, replace the "${output_file}" and "${input_file}" placeholders with the actual file paths and filenames you want to use. The resulting SHA-256 hash of the input file will be saved to the specified output file in binary format.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.