System Administration Guide: Security Services

ProcedureHow 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
  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

    Displays the output in the following format:

    algorithm (input-file) = digest
    -a algorithm

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


    Is the input file for the digest command.


    Is the output file for the digest command.

Example 14–8 Computing a Digest With the MD5 Mechanism

In the following example, the digest command uses the MD5 mechanism to compute a digest for an email attachment.

% digest -v -a md5 email.attach >>  $HOME/digest.emails.05.07
% cat  ~/digest.emails.05.07
md5 (email.attach) = 85c0a53d1a5cc71ea34d9ee7b1b28b01

When the -v option is not used, the digest is saved with no accompanying information:

% digest -a md5 email.attach >>  $HOME/digest.emails.05.07
% cat  ~/digest.emails.05.07

Example 14–9 Computing a Digest With the SHA1 Mechanism

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

% digest -v -a sha1 docs/* > $HOME/
% more ~/
sha1 (docs/legal1) = 1df50e8ad219e34f0b911e097b7b588e31f9b435
sha1 (docs/legal2) = 68efa5a636291bde8f33e046eb33508c94842c38
sha1 (docs/legal3) = 085d991238d61bd0cfa2946c183be8e32cccf6c9
sha1 (docs/legal4) = f3085eae7e2c8d008816564fdf28027d10e1d983