Go to main content

Managing Encryption and Certificates in Oracle® Solaris 11.4

Exit Print View

Updated: May 2021
 
 

How to Compute a Digest of a File

When you compute a digest of a file, you can check to see that the file has not been tampered with by comparing digest outputs. A digest does not alter the original file.

  1. List the available digest algorithms.
    $ digest -l
    sha1
    md5
    sha224
    sha256
    sha384
    sha512
    sha512_t
    sha3_224
    sha3_256
    sha3_384
    sha3_512
  2. Compute the digest of the file and save the digest listing.

    Provide an algorithm with the digest command.

    $ digest -v -a algorithm input-file > digest-listing
    –v

    Displays the output in the following format:

    algorithm (input-file) = digest
    –a algorithm

    The algorithm to use to compute a digest of the file. Type the algorithm as the algorithm appears in the output of Step 1.

    input-file

    The input file for the digest command.

    digest-listing

    The output file for the digest command.

Example 6  Computing a Digest With a SHA2 Mechanism

In the following example, the digest command uses a SHA2 mechanism to provide a directory listing. The results are placed in a file.

$ digest -v -a sha512 docs/* > $HOME/digest.docs.legal.05.07
$ more ~/digest.docs.legal.05.07
sha512 (docs/legal1) = a269d...c618e1bf19b3d5c9f835242708eb2b572d7b
sha512 (docs/legal2) = 57be3...59a7168564296c142715cc9ed979dd838a7b
sha512 (docs/legal3) = ed31d...0fb3b80d4cd58327bcc29b2e7b90a0af6770
sha512 (docs/legal4) = 67ce1...0ba0c55695614329110d0686bc2773630b5f