Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to generate hashes from list of files #971

Merged
merged 8 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions cli/xxhsum.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SYNOPSIS
--------

`xxhsum` [*OPTION*]... [*FILE*]...

`xxhsum -b` [*OPTION*]...

`xxh32sum` is equivalent to `xxhsum -H0`,
Expand Down Expand Up @@ -56,16 +57,23 @@ OPTIONS
* `-h`, `--help`:
Displays help and exits

### The following options are useful only when verifying checksums (-c):
### The following options are useful only when using lists in *FILE* (--check and --files-from):

* `-c`, `--check` *FILE*:
Read xxHash sums from *FILE* and check them

* `--files-from` *FILE*:
Read filenames from *FILE* and generate hashes for them.
Valid *FILE*s have one filename per line, which can include embedded spaces, etc with no need for quotes, escapes, etc.
Note that a line commencing with '\\' will enable the convention used in the encoding of filenames against output hashes,
whereby subsequent \\\\, \n and \r seqeuences are converted to the single
character 0x5C, 0x0A and 0x0D respectively.

* `-q`, `--quiet`:
Don't print OK for each successfully verified file
Don't print OK for each successfully verified hash (only for --check)

* `--strict`:
Return an error code if any line in the file is invalid,
Return an error code if any line in *FILE** is invalid,
not just if some checksums are wrong.
This policy is disabled by default,
though UI will prompt an informational message
Expand All @@ -75,7 +83,7 @@ OPTIONS
Don't output anything. Status code shows success.

* `-w`, `--warn`:
Emit a warning message about each improperly formatted checksum line.
Emit a warning message about each improperly formatted line in *FILE*.

### The following options are useful only benchmark purpose:

Expand Down Expand Up @@ -119,6 +127,19 @@ Read xxHash sums from specific files and check them

$ xxhsum -c xyz.xxh32 qux.xxh64

Produce a list of files, then generate hashes for that list

$ find . -type f -name '*.[ch]' > c-files.txt
$ xxhsum --files-from c-files.txt

Read the list of files from standard input to avoid the need for an intermediate file

$ find . -type f -name '*.[ch]' | xxhsum --files-from -

Note that if shell expansion, length of argument list, clarity of use of spaces in filenames, etc allow it then the same output as the previous example can be generated like this

$ xxhsum `find . -name '*.[ch]'`

Benchmark xxHash algorithm.
By default, `xxhsum` benchmarks xxHash main variants
on a synthetic sample of 100 KB,
Expand Down
Loading
Loading