1SHIRO-TOOLS-HASHER(1) shiro-tools-hasher SHIRO-TOOLS-HASHER(1)
2
3
4
6 shiro-tools-hasher - Print a cryptographic hash (aka message digest) of
7 the specified <value>.
8
10 usage: shiro-tools-hasher [OPTIONS...] [VALUE...]
11
13 shiro-tools-hasher
14
15 The following options are understood:
16
17 -a,--algorithm <name>
18 hash algorithm name. Defaults to SHA-256 when password hashing, MD5
19 otherwise.
20
21 -d,--debug
22 show additional error (stack trace) information.
23
24 -f,--format <arg>
25 hash output format. Defaults to 'shiro1' when password hashing,
26 'hex' otherwise.
27
28 -gs,--gensalt
29 generate and use a random salt. Defaults to true when password
30 hashing, false otherwise.
31
32 -gss,--gensaltsize <numBits>
33 the number of salt bits (not bytes!) to generate. Defaults to 128.
34
35 -help,--help
36 Show this help string
37
38 -i,--iterations <num>
39 number of hash iterations. Defaults to 500000 when password
40 hashing, 1 otherwise.
41
42 -ngs,--nogensalt
43 do NOT generate and use a random salt (valid during password
44 hashing).
45
46 -p,--password
47 hash a password (disable typing echo)
48
49 -pnc,--pnoconfirm
50 hash a password (disable typing echo) but disable password
51 confirmation prompt.
52
53 -r,--resource
54 read and hash the resource located at <value>
55
56 -s,--salt <sval>
57 use the specified salt. <arg> is plaintext.
58
59 -sb,--saltbytes <encTxt>
60 use the specified salt bytes. <arg> is hex or base64 encoded text.
61
63 <value> is optional only when hashing passwords. It is
64
65 required all other times.
66
68 ---------------------------------
69
70 Specify the -p/--password option and DO NOT enter a <value>. You will
71
72 be prompted for a password and characters will not echo as you type.
73
75 ---------------------------------
76
77 Specifying a salt:
78
79 You may specify a salt using the -s/--salt option followed by the salt
80
81 value. If the salt value is a base64 or hex string representing a
82
83 byte array, you must specify the -sb/--saltbytes option to indicate
84 this,
85
86 otherwise the text value bytes will be used directly.
87
88 When using -sb/--saltbytes, the -s/--salt value is expected to be a
89
90 base64-encoded string by default. If the value is a hex-encoded string,
91
92 you must prefix the string with 0x (zero x) to indicate a hex value.
93
94 Generating a salt:
95
96 Use the -sg/--saltgenerated option if you don't want to specify a salt,
97
98 but want a strong random salt to be generated and used during hashing.
99
100 The generated salt size defaults to 128 bits. You may specify
101
102 a different size by using the -sgs/--saltgeneratedsize option followed
103 by
104
105 a positive integer (size is in bits, not bytes).
106
107 Because a salt must be specified if computing the
108
109 hash later, generated salts will be printed, defaulting to base64
110
111 encoding. If you prefer to use hex encoding, additionally use the
112
113 -sgh/--saltgeneratedhex option.
114
116 ---------------------------------
117
118 If using the -r/--resource option, the <value> represents a resource
119 path.
120
121 By default this is expected to be a file path, but you may specify
122
123 classpath or URL resources by using the classpath: or url: prefix
124
125 respectively.
126
127 Some examples:
128
129 <command> -r fileInCurrentDirectory.txt
130
131 <command> -r ../../relativePathFile.xml
132
133 <command> -r ~/documents/myfile.pdf
134
135 <command> -r /usr/local/logs/absolutePathFile.log
136
137 <command> -r url:http://foo.com/page.html
138
139 <command> -r classpath:/WEB-INF/lib/something.jar
140
142 ---------------------------------
143
144 Specify the -f/--format option followed by either 1) the format ID (as
145 defined
146
147 by the org.apache.shiro.crypto.hash.format.DefaultHashFormatFactory
148
149 JavaDoc) or 2) the fully qualified
150 org.apache.shiro.crypto.hash.format.HashFormat
151
152 implementation class name to instantiate and use for formatting.
153
154 The default output format is 'shiro1' which is a Modular Crypt Format
155 (MCF)
156
157 that shows all relevant information as a dollar-sign ($) delimited
158 string.
159
160 This format is ideal for use in Shiro's text-based user configuration
161 (e.g.
162
163 shiro.ini or a properties file).
164
165
166
167shiro-tools-hasher 02/02/2019 SHIRO-TOOLS-HASHER(1)