20 个版本

使用旧的 Rust 2015

0.9.1 2021 年 11 月 5 日
0.9.0 2021 年 6 月 3 日
0.8.1 2021 年 5 月 31 日
0.7.1 2021 年 1 月 4 日
0.5.2 2016 年 9 月 21 日

#1124 in 文件系统

Download history 44/week @ 2024-03-13 33/week @ 2024-03-20 44/week @ 2024-03-27 72/week @ 2024-04-03 65/week @ 2024-04-10 87/week @ 2024-04-17 54/week @ 2024-04-24 49/week @ 2024-05-01 74/week @ 2024-05-08 111/week @ 2024-05-15 83/week @ 2024-05-22 94/week @ 2024-05-29 163/week @ 2024-06-05 315/week @ 2024-06-12 147/week @ 2024-06-19 59/week @ 2024-06-26

715 每月下载量
4 crates 中使用

MIT 许可证

49KB
883

checksums TravisCI 构建状态 AppVeyorCI 构建状态 许可证 Crates.io 版本

目录树制作/验证校验和的工具。

使用生成的校验和自动验证文件/目录树的正确性。

手册页

文档

特别感谢

所有在 Patreon 上支持进一步开发的人,特别是

  • ThePhD
  • Embark Studios
  • Jasper Bekkers

lib.rs:

目录树制作/验证校验和的工具。

库文档

此库由 checksums 本身用于所有功能,因此包含所有必要的函数。

数据流

哈希验证

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

哈希创建

Options
|> create_hashes()
|> write_hashes()

可执行手册页

退出值和可能的错误

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

概述

checksums [选项] [目录]

描述

目录树制作/验证校验和的工具。

使用生成的校验和自动验证文件/目录树的正确性。

所有输出都换行到 80 列。

选项

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

强制

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

-j --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 to create/verify hash for. Default: current workdir.

示例

checksums [-v] [-f 输入文件]

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 输出文件] --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 深度] [-r] [其他 选项]

Recurse *depth* or infinity directories down.

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

特别感谢

特别感谢所有在 Patreon 上支持进一步开发的人

  • ThePhD
  • Embark Studios
  • Jasper Bekkers

依赖项

~6–15MB
~180K SLoC