Debian Codegraph @

third-party/xxhash/cli/xxhsum.1.md

raw
1 xxhsum(1) -- print or check xxHash non-cryptographic checksums
2 ==============================================================
3
4 SYNOPSIS
5 --------
6
7 `xxhsum` [*OPTION*]... [*FILE*]...
8
9 `xxhsum -b` [*OPTION*]...
10
11 `xxh32sum` is equivalent to `xxhsum -H0`,
12 `xxh64sum` is equivalent to `xxhsum -H1`,
13 `xxh128sum` is equivalent to `xxhsum -H2`,
14 `xxh3sum` is equivalent to `xxhsum -H3`.
15
16
17 DESCRIPTION
18 -----------
19
20 Print or check xxHash (32, 64 or 128 bits) checksums.
21 When no *FILE*, read standard input, except if it's the console.
22 When *FILE* is `-`, read standard input even if it's the console.
23
24 `xxhsum` supports a command line syntax similar but not identical to md5sum(1). Differences are:
25
26 * `xxhsum` doesn't have text mode switch (`-t`)
27 * `xxhsum` doesn't have short binary mode switch (`-b`)
28 * `xxhsum` always treats files as binary file
29 * `xxhsum` has a hash selection switch (`-H`)
30
31 As xxHash is a fast non-cryptographic checksum algorithm,
32 `xxhsum` should not be used for security related purposes.
33
34 `xxhsum -b` invokes benchmark mode. See OPTIONS and EXAMPLES for details.
35
36 OPTIONS
37 -------
38
39 * `-H`*HASHTYPE*:
40 Hash selection. *HASHTYPE* means `0`=XXH32, `1`=XXH64, `2`=XXH128, `3`=XXH3.
41 Alternatively, *HASHTYPE* `32`=XXH32, `64`=XXH64, `128`=XXH128.
42 Default value is `1` (XXH64)
43
44 * `--binary`:
45 Read in binary mode.
46
47 * `--tag`:
48 Output in the BSD style.
49
50 * `--little-endian`:
51 Set output hexadecimal checksum value as little endian convention.
52 By default, value is displayed as big endian.
53
54 * `-V`, `--version`:
55 Displays xxhsum version and exits
56
57 * `-h`, `--help`:
58 Displays help and exits
59
60 ### Advanced file input options
61
62 * `--files-from`, `--filelist` *FILE*:
63 Read filenames from *FILE* and generate hashes for them.
64 `stdin` is also a valid way to provide filenames (when no *FILE* or `-` provided).
65 Valid format is one filename per line, which can include embedded spaces, etc with no need for quotes, escapes, etc.
66 A line commencing with '\\' will enable the convention used in the encoding of filenames against output hashes,
67 whereby subsequent \\\\, \n and \r seqeuences are converted to the single
68 character 0x5C, 0x0A and 0x0D respectively.
69
70 ### The following options are useful only for checksum verification:
71
72 * `-c`, `--check` *FILE*:
73 Read xxHash sums from *FILE* and check them
74
75 * `--strict`:
76 Return an error code if any line in *FILE* is invalid,
77 not just if some checksums are wrong.
78 This policy is disabled by default,
79 though UI will prompt an informational message
80 if any line in the file is detected invalid.
81
82 * `-w`, `--warn`:
83 Emit a warning message about each improperly formatted line in *FILE*.
84
85 * `-q`, `--quiet`:
86 Don't print OK for each successfully verified hash
87
88 * `--status`:
89 Don't output anything. Only generate a Status code to show success.
90
91 ### The following options are useful only benchmark purpose:
92
93 * `-b`:
94 Benchmark mode. See EXAMPLES for details.
95
96 * `-b#`:
97 Specify ID of variant to be tested.
98 Multiple variants can be selected, separated by a ',' comma.
99
100 * `-B`*BLOCKSIZE*:
101 Only useful for benchmark mode (`-b`). See *EXAMPLES* for details.
102 <BLOCKSIZE> specifies benchmark mode's test data block size in bytes.
103 Default value is 102400
104
105 * `-i`*ITERATIONS*:
106 Only useful for benchmark mode (`-b`). See *EXAMPLES* for details.
107 <ITERATIONS> specifies number of iterations in benchmark. Single iteration
108 lasts approximately 1000 milliseconds. Default value is 3
109
110 EXIT STATUS
111 -----------
112
113 `xxhsum` exit `0` on success, `1` if at least one file couldn't be read or
114 doesn't have the same checksum as the `-c` option.
115
116 EXAMPLES
117 --------
118
119 Output xxHash (64bit) checksum values of specific files to standard output
120
121 $ xxhsum -H1 foo bar baz
122
123 Output xxHash (32bit and 64bit) checksum values of specific files to standard
124 output, and redirect it to `xyz.xxh32` and `qux.xxh64`
125
126 $ xxhsum -H0 foo bar baz > xyz.xxh32
127 $ xxhsum -H1 foo bar baz > qux.xxh64
128
129 Read xxHash sums from specific files and check them
130
131 $ xxhsum -c xyz.xxh32 qux.xxh64
132
133 Produce a list of files, then generate hashes for that list
134
135 $ find . -type f -name '*.[ch]' > c-files.txt
136 $ xxhsum --files-from c-files.txt
137
138 Read the list of files from standard input to avoid the need for an intermediate file
139
140 $ find . -type f -name '*.[ch]' | xxhsum --files-from -
141
142 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
143
144 $ xxhsum `find . -name '*.[ch]'`
145
146 Benchmark xxHash algorithm.
147 By default, `xxhsum` benchmarks xxHash main variants
148 on a synthetic sample of 100 KB,
149 and print results into standard output.
150 The first column is the algorithm,
151 the second column is the source data size in bytes,
152 the third column is the number of hashes generated per second (throughput),
153 and finally the last column translates speed in megabytes per second.
154
155 $ xxhsum -b
156
157 In the following example,
158 the sample to hash is set to 16384 bytes,
159 the variants to be benched are selected by their IDs,
160 and each benchmark test is repeated 10 times, for increased accuracy.
161
162 $ xxhsum -b1,2,3 -i10 -B16384
163
164 BUGS
165 ----
166
167 Report bugs at: https://github.com/Cyan4973/xxHash/issues/
168
169 AUTHOR
170 ------
171
172 Yann Collet
173
174 SEE ALSO
175 --------
176
177 md5sum(1)