aboutsummaryrefslogtreecommitdiffstats
path: root/anysum.1
blob: b2038cca393e72408383a65e092e5833b7c951b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
.TH ANYSUM 1 anysum
.SH NAME
anysum - compute or verify against multiple checksums

.SH SYNOPSIS
.B anysum
.RB ( -c
.RB [ -w ]
|
.RB [ -a
.IR algoritms ]\ ...)
.RB [ -W
.IR options ]\ ...
.RB [ -z ]
.RI [ file ]\ ...

.SH DESCRIPTION
The
.B anysum
utility can calculate checksums of a file using
multiple hash functions, or using different parameters for
the function, in parallel (the utility can calculate checksums
for multiple files, but these are not calculated in parallel).
.PP
The
.B anysum
utility can also check a file against multiple
checksums using multiple hash function and hash function
parameters in parallel, and check that the file matches at
least one of the listed checksums.

.SH OPTIONS
The anysum utility conforms to the Base Definitions volume of
POSIX.1-2017,
.IR "Section 12.2" ,
.IR "Utility Syntax Guidelines" .
.PP
The following options are supported:
.TP
.BR -a \ \fIalgorithms\fP
Comma-separated list of hash functions and
parameters to compute checksums with.

Currently supported values are:
.RS
.TP
.B md2
For MD2.
.TP
.B md4
For MD4.
.TP
.B md5
For MD5.
.TP
.BR ripemd128 " or " rmd128
For RIPEMD-128.
.TP
.BR ripemd160 " or " rmd160
For RIPEMD-160.
.TP
.BR ripemd256 " or " rmd256
For RIPEMD-256.
.TP
.BR ripemd320 " or " rmd320
For RIPEMD-320.
.TP
.B sha0
For SHA-0.
.TP
.B sha1
For SHA-1.
.TP
.B sha224
For the 224 bit version of SHA-2.
.TP
.B sha256
For the 256 bit version of SHA-2.
.TP
.B sha384
For the 384 bit version of SHA-2.
.TP
.B sha512
For the 512 bit version of SHA-2.
.TP
.B sha512/224
For the 224 bit output variant of the
512 (and 384) bit version of SHA-2.
.TP
.B sha512/256
For the 256 bit output variant of the
512 (and 384) bit version of SHA-2.
.TP
.BI keccak[r= bitrate ,c= capacity ,n= length ,z= squeezes ]
For Keccak. The brackets and there parameter
list, and each parameter, are optional. Any
parameter the is skipped is automatically
determined.
.I bitrate
and
.I capacity
are the Keccak function's bitrate and
capacity bit bits, and
.I length
is the hash length is bits.
.I squeezes
is the number of squeezes to perform
after a input has been feed into the function;
the default is one, and any number in excess
of this is the number of squeezes to perform
before squeezing out the hash.
.TP
.B keccak-224
For Keccak[r=1152,c=448,n=224].
.TP
.B keccak-256
For Keccak[r=1088,c=512,n=256].
.TP
.B keccak-384
For Keccak[r=832,c=768,n=384].
.TP
.B keccak-512
For Keccak[r=576,c=1024,n=512].
.TP
.B sha3-224
For the 224 bit version of SHA-3.
.TP
.B sha3-256
For the 256 bit version of SHA-3.
.TP
.B sha3-384
For the 384 bit version of SHA-3.
.TP
.B sha3-512
For the 512 bit version of SHA-3.
.TP
.BI shake-128[n= length ]
For the 128 bit version of SHAKE. The brackets and
.BI n= length
are optional;
.I length
shall the output size in bits (default is 128).
.TP
.BI shake-256[n= length ]
For the 256 bit version of SHAKE. The brackets and
.BI n= length
are optional;
.I length
shall the output size in bits (default is 256).
.TP
.BI shake-512[n= length ]
For the 512 bit version of SHAKE. The brackets and
.BI n= length
are optional;
.I length
shall the output size in bits (default is 512).
.TP
.BI rawshake-128[n= length ]
For the 128 bit version of RawSHAKE. The
brackets and
.BI n= length
are optional;
.I length
shall the output size in bits (default is 128).
.TP
.BI rawshake-256[n= length ]
For the 256 bit version of RawSHAKE. The
brackets and
.BI n= length
are optional;
.I length
shall the output size in bits (default is 256).
.TP
.BI rawshake-512[n= length ]
For the 512 bit version of RawSHAKE. The
brackets and
.BI n= length
are optional;
.I length
shall the output size in bits (default is 512).
.TP
.BR blake224[salt= \fIsalt\fP ] " or " b224[salt= \fIsalt\fP ]
For the 224 bit version of BLAKE. The brackets and
.BI salt= salt
are optional;
.I salt
shall be a 32 character long hexadecimal value.
.TP
.BR blake256[salt= \fIsalt\fP ] " or " b256[salt= \fIsalt\fP ]
For the 256 bit version of BLAKE. The brackets and
.BI salt= salt
are optional;
.I salt
shall be a 32 character long hexadecimal value.
.TP
.BR blake384[salt= \fIsalt\fP ] " or " b384[salt= \fIsalt\fP ]
For the 384 bit version of BLAKE. The brackets and
.BI salt= salt
are optional;
.I salt
shall be a 64 character long hexadecimal value.
.TP
.BR blake512[salt= \fIsalt\fP ] " or " b512[salt= \fIsalt\fP ]
For the 512 bit version of BLAKE. The brackets and
.BI salt= salt
are optional;
.I salt
shall be a 64 character long hexadecimal value.
.PP
The utility does also recognise similar values
that are obviously equivalent.
.RE
.TP
.B -b
Read in binary mode when computing hashes.
.TP
.B -c
Verify the the files listed in file against the
checksums listed on the same lines. The file
shall be formatted as the output of the utility
when this option is not used. See the
.B STDOUT
section for more information. If a file is listed
multiple times, it need only match one of the
checksums listed for the file.

The length of the listed checksums need not match
the length output by this utility; before the
checksums are compared, they are truncated to the
shorter of the two checksums.
.TP
.B -t
Read in text mode when computing hashes.
.TP
.BR -W \ \fIoptions\fP
Comma-sepearated list of implementation-specific
options. The following options are supported:
.RS
.TP
.BI output= format
.I format
shall be
.RB \(dq lowercase \(dq
if the checksums shall be printed in lowercase
hexadecimal format (default),
.RB \(dq uppercase \(dq
for uppercase hexadecimal format, or
.RB \(dq binary \(dq
for binary format without anything but the
checksum printed to standard output. This
option is ignored if the
.B -c
option is used.
.TP
.BI input= format
.I format
shall be
.RB \(dq binary \(dq
if the files are be read in binary mode,
.RB \(dq text \(dq
if the files shall be read in text mode, or
.RB \(dq hexadecimal \(dq
they shall be decoded from hexadecimal to
binary. If the
.B -c
option is used, the mode specification
associated with a file is overrides this
behaviour for that file if the line
specifies hexadecimal mode.
.TP
.BI threads= count
The maximum number of threads that the
utility may use. If
.RB \(dq auto \(dq
is specified, the utility selects a default
value, which currently is the number of
online CPU threads (at any time; assumed to
be 8 if it cannot be determined) minus 2,
or 1 if this would be less than 1.
.TP
.B recursive
If a
.I file
operand is a directory, the checksum is computed for
all files recursively. This option is ignored if the
.B -c
option is used.
.TP
.B no-recursive
The utility shall traverse directories.
(This is the default behaviour).
.RE
.TP
.B -w
Warn about, but skip, lines that are not properly
formatted.
.TP
.B -z
Use NUL byte as line ending instead of LF.
.PP
There is no difference between binary mode and text mode,
so the
.B -b
and
.B -t
options are ignored, except that they undo
.BR "-W input=hexadecimal" .

.SH OPERANDS
The following operand is supported:
.TP
.I file
The file to read and compute the checksum for, or if the
.B -c
option is used, use as the listing of files and checksums
to verify the files against. If dash
.RB (' - ')
is used or if no file operand is specified, standard input
will be used.

.SH STDOUT
If the
.B -c
option is not used, the utility shall print the following
line for each calculated checksum, however there are options
that modify the format; see the
.B OPTIONS
section for more information:
.PP
.RS
.B \(dq%s:%s %c%s\en\(dq,
.RI < "hash function" >\fB,\fP
.RI < hash >\fB,\fP
.RI < mode >\fB,\fP
.RI < file >
.RE
.PP
where
.I mode
is SP (' ') for text mode, an asterisk
.RB (' * ')
for binary mode, or a pound sign
.RB (' # ')
for hexadecimal mode; however if there is no difference
between binary mode and text mode and either is selected,
SP (' ') (text mode) is used.
.PP
If the
.B -c
option the output shall be on the format:
.PP
.RS
.B \(dq%s: %s\en\(dq,
.RI < file >\fB,\fP
.RI < validity >
.RE
.PP
where
.I validity
is an implementation specified string
that describes whether the checksum was valid (possibly
with remarks), the file did not exist, the file could
not be read (possibly with error information), or if
the checksum was invalid or could not be compared
(possibly with remarks). The
.B -z
option does not modify the line ending.

.SH EXIT STATUS
The following exit values are returned:
.TP
0
Successful completion.
.TP
1
Checksums did not match or a file did not exist.
.TP
2
An error occurred.

.SH NOTES
Other implementations do not necessarily recognise the
hexadecimal mode specifier
.RB (' # ')
in checksum list files.
.PP
The
.B -c
option accepting truncated checksums is an
implementation-specific behaviour.

.SH SEE ALSO
.BR md2sum (1),
.BR md4sum (1),
.BR md5sum (1),
.BR rmd128sum (1),
.BR rmd256sum (1),
.BR rmd384sum (1),
.BR rmd512sum (1),
.BR sha0sum (1),
.BR sha1sum (1),
.BR sha224sum (1),
.BR sha256sum (1),
.BR sha384sum (1),
.BR sha512sum (1),
.BR sha512-224sum (1),
.BR sha512-256sum (1),
.BR sha3sum (1),
.BR sha3-224sum (1),
.BR sha3-256sum (1),
.BR sha3-384sum (1),
.BR sha3-512sum (1),
.BR keccaksum (1),
.BR keccak224sum (1),
.BR keccak256sum (1),
.BR keccak384sum (1),
.BR keccak512sum (1),
.BR shake128sum (1),
.BR shake256sum (1),
.BR shake512sum (1),
.BR rawshake128sum (1),
.BR rawshake256sum (1),
.BR rawshake512sum (1),
.BR bsum (1),
.BR b224sum (1),
.BR b256sum (1),
.BR b384sum (1),
.BR b512sum (1)