/archive-sum

verify archive file integrity

Primary LanguageCMIT LicenseMIT

archive-sum

Generates checksums of files within an archive file without extracting its contents.

Build Status Codacy Badge

Table of Contents

Usage

In its simplest form, archive-sum prints the checksums of the files within an archive:

$ archive-sum example.tar.gz
c157a79031e1c40f85931829bc5fc552  example/bar
258622b1688250cb619f3c9ccaefb7eb  example/baz
d3b07384d113edec49eaa6238ad5ff00  example/foo

If you want a different hash function (digest), specify it like this:

$ archive-sum -d sha256 example.tar.gz
7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730  example/bar
bf07a7fbb825fc0aae7bf4a1177b2b31fcf8a3feeaf7092761e18c859ee52a9c  example/baz
b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c  example/foo

To get a more detailed help, take a look at the archive-sum help text:

archive-sum --help

Archive Verification

The primary use of archive-sum is to verify the integrity of archive files by verifying its contents. First, so you can see and reproduce the entire workflow, lets create an archive:

mkdir example
echo foo > example/foo
echo bar > example/bar
echo baz > example/baz
tar czf example.tar.gz example/

We can now verify the integrity of the archive by comparing the contents of the archive with the original files:

$ archive-sum -c example.tar.gz
example/foo: OK
example/baz: OK
example/bar: OK

As you can see from the output, the content of the archive file is exactly the same as the original. We verified the integrity of the archive file.

Installation

Arch Linux

Install the archive-sum AUR package:

pacaur -S archive-sum

Manual

dependencies:

  • the libarchive multi-format archive and compression library
  • the OpenSSL cryptography library

building:

The build requires the dependencies to be available and they are detected using their pkg-config files.

meson build
ninja -C build

testing:

meson test -C build --no-suite lfs

install:

ninja -C build install

Supported Archive File Formats

All archive formats are supported that your version of libarchive supports (for all possible ones of the latest libarchive version, see here). The following libarchive man page lists its supported formats:

man 5 libarchive-formats

Supported Hash Functions (Digests)

All hash functions are supported that your local version of OpenSSL supports. You can get a list from your OpenSSL installation:

openssl list-message-digest-algorithms