-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathxhash.1
More file actions
127 lines (119 loc) · 2.97 KB
/
xhash.1
File metadata and controls
127 lines (119 loc) · 2.97 KB
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
.Dd April 19, 2025
.Dt XHASH 1
.Os
.Sh NAME
.Nm xhash
.Nd compute multiple hashes on strings, files, and directories
.Sh SYNOPSIS
.Nm
.Op OPTIONS
.Op Fl s Ar STRING ...
.Op Fl c Ar FILE
.Op Fl i Ar FILE
.Op Ar FILE ...
.Op Fl r Ar FILE ... DIRECTORY ...
.Sh DESCRIPTION
.Nm
is a Go program that uses goroutines to calculate multiple hashes on strings, files, and directories.
By default, it reads from standard input.
The output format is fully configurable.
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl a , Fl -all
Use all algorithms (except others specified, if any)
.It Fl b , Fl -base64
Output hash in Base64 encoding format
.It Fl -blake2b-256
Use BLAKE2b-256 algorithm
.It Fl -blake2b-512
Use BLAKE2b-512 algorithm
.It Fl -blake2s-256
Use BLAKE2s-256 algorithm
.It Fl -blake3
Use BLAKE3 algorithm
.It Fl c , Fl -check Ar file
Read checksums from file (use "" for stdin) (default "\\x00")
.It Fl f , Fl -format Ar string
Output format (default "{{range .}}{{.Name}} ({{.File}}) = {{.Sum }}\\n{{end}}")
.It Fl -gnu
Use the GNU
.Nm md5sum
output format
.It Fl H , Fl -hmac Ar key
Key for HMAC (in hexadecimal) or read from specified pathname (default "\\x00")
.It Fl -ignore-missing
Don't fail or report status for missing files
.It Fl i , Fl -input Ar file
Read pathnames from file (use "" for stdin) (default "\\x00")
.It Fl -md5
Use MD5 algorithm
.It Fl q , Fl -quiet
Don't print OK for each successfully verified file
.It Fl r , Fl -recursive
Recurse into directories
.It Fl -sha1
Use SHA1 algorithm
.It Fl -sha256
Use SHA256 algorithm
.It Fl -sha3-256
Use SHA3-256 algorithm
.It Fl -sha3-512
Use SHA3-512 algorithm
.It Fl -sha512
Use SHA512 algorithm
.It Fl -sha512-256
Use SHA512-256 algorithm
.It Fl -size
Include file size in output
.It Fl S , Fl -status
Don't output anything; status code shows success
.It Fl -strict
Exit non-zero for improperly formatted checksum lines
.It Fl s , Fl -string
Treat arguments as strings
.It Fl L , Fl -symlinks
Follow symbolic links while recursing directories
.It Fl v , Fl -verbose
Verbose operation
.It Fl -version
Show version and exit
.It Fl w , Fl -warn
Warn about improperly formatted checksum lines
.It Fl z , Fl -zero
End each output line with NUL, not newline, and disable file name escaping
.El
.Sh EXAMPLES
To hash every file in your home directory using both SHA-512 and SHA-256:
.Bd -literal
xhash -r -sha512 -sha256 $HOME
.Ed
To hash the /etc/passwd file with all algorithms except MD5 and SHA-1:
.Bd -literal
xhash -all -md5 -sha1 /etc/passwd
.Ed
To hash the string "abc" with all algorithms:
.Bd -literal
xhash -all -s "abc"
.Ed
To check the hashes in /tmp/hashes.md5:
.Bd -literal
xhash -c /tmp/hashes.md5
.Ed
To hash all files specified in /tmp/files.list:
.Bd -literal
xhash -i /tmp/files.list
.Ed
.Sh OUTPUT FORMAT
The default format is the same as the BSD commands.
Use
.Fl -gnu
to use the format used by
.Nm md5sum .
To mimic the format used by
.Nm hashdeep ,
use:
.Bd -literal
--size -f '{{range .}}{{.Sum}},{{end}}{{(index . 0).File}}\\n'
.Ed
.Sh AUTHORS
.An Ricardo Branco