in tools/hasher/src/main/java/org/apache/shiro/tools/hasher/Hasher.java [394:472]
private static void printHelp(Options options, Exception e, boolean debug) {
HelpFormatter help = new HelpFormatter();
String command = "java -jar shiro-tools-hasher-<version>.jar [options] [<value>]";
String header = "\nPrint a cryptographic hash (aka message digest) of the specified <value>.\n--\nOptions:";
String footer = "\n<value> is optional only when hashing passwords (see below). It is\n"
+ "required all other times."
+ "\n\n"
+ "Password Hashing:\n"
+ "---------------------------------\n"
+ "Specify the -p/--password option and DO NOT enter a <value>. You will\n"
+ "be prompted for a password and characters will not echo as you type."
+ "\n\n"
+ "Salting:\n"
+ "---------------------------------\n"
+ "Specifying a salt:"
+ "\n\n"
+ "You may specify a salt using the -s/--salt option followed by the salt\n"
+ "value. If the salt value is a base64 or hex string representing a\n"
+ "byte array, you must specify the -sb/--saltbytes option to indicate this,\n"
+ "otherwise the text value bytes will be used directly."
+ "\n\n"
+ "When using -sb/--saltbytes, the -s/--salt value is expected to be a\n"
+ "base64-encoded string by default. If the value is a hex-encoded string,\n"
+ "you must prefix the string with 0x (zero x) to indicate a hex value."
+ "\n\n"
+ "Generating a salt:"
+ "\n\n"
+ "Use the -gs/--gensalt option if you don't want to specify a salt,\n"
+ "but want a strong random salt to be generated and used during hashing.\n"
+ "The generated salt size defaults to 128 bits. You may specify\n"
+ "a different size by using the -gss/--gensaltsize option followed by\n"
+ "a positive integer (size is in bits, not bytes)."
+ "\n\n"
+ "Because a salt must be specified if computing the hash later,\n"
+ "generated salts are only useful with the shiro1/shiro2 output format;\n"
+ "the other formats do not include the generated salt."
+ "\n\n"
+ "Specifying a private salt:"
+ "\n\n"
+ "You may specify a private salt using the -ps/--privatesalt option followed\n"
+ "by the private salt value. If the private salt value is a base64 or hex \n"
+ "string representing a byte array, you must specify the -psb/--privatesaltbytes\n"
+ "option to indicate this, otherwise the text value bytes will be used directly."
+ "\n\n"
+ "When using -psb/--privatesaltbytes, the -ps/--privatesalt value is expected to\n"
+ "be a base64-encoded string by default. If the value is a hex-encoded string,\n"
+ "you must prefix the string with 0x (zero x) to indicate a hex value."
+ "\n\n"
+ "Files, URLs and classpath resources:\n"
+ "---------------------------------\n"
+ "If using the -r/--resource option, the <value> represents a resource path.\n"
+ "By default this is expected to be a file path, but you may specify\n"
+ "classpath or URL resources by using the classpath: or url: prefix\n"
+ "respectively."
+ "\n\n"
+ "Some examples:"
+ "\n\n"
+ "<command> -r fileInCurrentDirectory.txt\n"
+ "<command> -r ../../relativePathFile.xml\n"
+ "<command> -r ~/documents/myfile.pdf\n"
+ "<command> -r /usr/local/logs/absolutePathFile.log\n"
+ "<command> -r url:http://foo.com/page.html\n"
+ "<command> -r classpath:/WEB-INF/lib/something.jar"
+ "\n\n"
+ "Output Format:\n"
+ "---------------------------------\n"
+ "Specify the -f/--format option followed by either 1) the format ID (as defined\n"
+ "by the " + DefaultHashFormatFactory.class.getName() + "\n"
+ "JavaDoc) or 2) the fully qualified " + HashFormat.class.getName() + "\n"
+ "implementation class name to instantiate and use for formatting.\n\n"
+ "The default output format is 'shiro2' which is a Modular Crypt Format (MCF)\n"
+ "that shows all relevant information as a dollar-sign ($) delimited string.\n"
+ "This format is ideal for use in Shiro's text-based user configuration (e.g.\n"
+ "shiro.ini or a properties file).";
printException(e, debug);
LOG.info("");
help.printHelp(command, header, options, null);
LOG.info(footer);
}