openssl Verified current stable Not installed? Security

Openssl / Calculate Sha256 Digest To File

Calculate Sha256 Digest To File

Use OpenSSL to compute the SHA256 digest of a file and save it to a specified output file.

$
Terminal
openssl dgst -sha256 -binary -out <output_file> <input_file>

When To Use

Use this command to securely hash a file's contents for verification.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
openssl dgst -sha256 -binary -out <output_file> <input_file>

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
$ openssl dgst -sha256 -binary -out digest.bin input.txt

Command Breakdown

What each part is doing

openssl
Base Command
The executable that performs this operation. Here it runs Openssl before the shell applies any redirect operators.
<output_file>
Input Files
The file path or paths supplied to this command.
<input_file>
Input Files
The file path or paths supplied to this command.
-sha256
Command Option
Tool-specific option used by this command invocation.
-binary
Command Option
Tool-specific option used by this command invocation.
-out
Command Option
Tool-specific option used by this command invocation.

How To Run

Execution path

  1. Step 1

    Replace {{output_file}} with your desired output file name.

  2. Step 2

    Replace {{input_file}} with the file you want to hash.

  3. Step 3

    Run the command to generate the SHA256 digest.

Alternative Approaches

Comparable commands in other tools

Alternative security tools for the same job.