20 releases

Uses old Rust 2015

0.9.1 Nov 5, 2021
0.9.0 Jun 3, 2021
0.8.1 May 31, 2021
0.7.1 Jan 4, 2021
0.5.2 Sep 21, 2016

#1194 in Filesystem

Download history 51/week @ 2024-07-20 118/week @ 2024-07-27 56/week @ 2024-08-03 161/week @ 2024-08-10 233/week @ 2024-08-17 222/week @ 2024-08-24 515/week @ 2024-08-31 183/week @ 2024-09-07 76/week @ 2024-09-14 158/week @ 2024-09-21 143/week @ 2024-09-28 282/week @ 2024-10-05 231/week @ 2024-10-12 519/week @ 2024-10-19 412/week @ 2024-10-26 505/week @ 2024-11-02

1,730 downloads per month
Used in 4 crates

MIT license

49KB
883 lines

checksums TravisCI build status AppVeyorCI build status Licence Crates.io version

Tool for making/verifying checksums of directory trees.

Use the generated checksums to automatically verify file/directory tree correctness.

Manpage

Docs

Special thanks

To all who support further development on Patreon, in particular:

  • ThePhD
  • Embark Studios
  • Jasper Bekkers

lib.rs:

Tool for making/verifying checksums of directory trees.

Library doc

This library is used by checksums itself for all its function and is therefore contains all necessary functions.

Data flow

Hash verification

Options
|> create_hashes()
|> load_hashes()
|> compare_hashes()
|> write_hash_comparison_results()

Hash creation

Options
|> create_hashes()
|> write_hashes()

Executable manpage

Exit values and possible errors:

1   - option parsing error
2   - hash lengths differ between selected and saved
3   - failed to parse hashes file
N+3 - N files didn't match

SYNOPSIS

checksums [OPTIONS] [DIRECTORY]

DESCRIPTION

Tool for making/verifying checksums of directory trees.

Use the generated checksums to automatically verify file/directory tree correctness.

All output is wrapped to 80 columns.

OPTIONS

-a --algorithm <algorithm>

Set the hashing algorithm to use, case-insensitive.

Supported algorithms: SHA1, SHA2-256, SHA2-512, SHA3-256, SHA3-512, BLAKE,
                      BLAKE2B, BLAKE2S, BLAKE3, CRC8, CRC16, CRC32, CRC64,
                      MD5, MD6-128, MD6-256, MD6-512, XOR8

BLAKE2 is equivalent to BLAKE2B for compatibility.

-c --create

Create directory hashes, rather than verifying them.

Directory hashes are output to the output file, which, if not specified, will
be "`DIRECTORY`.hash".

Will fail if the output file already exists and `--force` is not specified.

Exclusive with `--verify`. Overrides `--verify`.

-v --verify

Verify directory hashes. Default.

Exclusive with `--create`. Overrides `--create`.

-d --depth <depth>

Set max recursion depth to `depth`. Default: 0.

Exclusive with `--recursive`. Overrides `--recursive`.

-r --recursive

Set max recursion depth to infinity.

Exclusive with `--depth`. Overrides `--depth`.

--follow-symlinks

Recurse down symlinks. Default.

--no-follow-symlinks

Don't recurse down symlinks.

-i --ignore <filename[,filename2][,filename3][,filenameN]...>...

Add filename(s) to ignored files list. Default: none.

Ignored files are marked as such.

Accepted multiple times.

--force

Override output file in `--create` mode. No meaning in `--verify` mode.

-j --jobs [jobs]

Amount of threads used for hashing. Default: # of CPU threads

One thread can hash one file at a time, potentially speeding up hashing
up to `jobs` times.

No/empty value: # of CPU threads. -1: Infinite

[DIRECTORY]

Directory to create/verify hash for. Default: current workdir.

EXAMPLES

checksums [-v] [-f infile]

Verify the current directory tree against the saved hashes.

`-v` is not necessary as it's the default.

*infile* defaults to "`DIRECTORY`.hash"

Example output:
  File added: "file_that_was_not_here_before"
  File removed: "file_that_was_here_before_but_not_now"
  File ignored: "file_specified_with_ignore_now_or_during_creation"

  File "file_that_did_not_change" matches
  File "changed_file" doesn't match
    Was: 8313958F86F7B15D4775D12886D479C1CFAAA111
    Is : FCFC1548B30B5ACB25A7421D068E12F07DF74DCC

examples -c [-f outfile] --force

Create hashes of the current directory tree for later verification.

*outfile* defaults to "`DIRECTORY`.hash".

Use `--force` to override *outfile*.

Example output:
  FILENAME 722 / 722 [===============================================] 100.00 %

*outfile* contents:
  a_file.txt      8313958F86F7B15D4775D12886D479C1CFAAA111
  *outfile*.hash  ----------------------------------------
  different_file  8D742C1F2D39434771039E98AD854C72F91FCCA5

examples [-d depth] [-r] [OTHER OPTIONS]

Recurse *depth* or infinity directories down.

Example output for *depth*=2:
  File "dir1/dir2/file" matches
  File "dir1/file" matches
  File "file" matches

Special thanks

To all who support further development on Patreon, in particular:

  • ThePhD
  • Embark Studios
  • Jasper Bekkers

Dependencies

~7–15MB
~202K SLoC