private static char[] readPassword(boolean confirm) throws IOException {
        java.io.Console console = System.console();
        char[] first;
        if (isTerminal(console)) {
            first = console.readPassword("%s", "Password to hash: ");
        } else if (System.in != null) {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String readLine = br.readLine();
            first = readLine.toCharArray();
        } else {
            throw new IllegalStateException("java.io.Console and java.lang.System.in are not available on the current JVM."
                    + " Cannot read passwords.");
        }

        if (first == null || first.length == 0) {
            throw new IllegalArgumentException("No password specified.");
        }
        if (confirm && isTerminal(console)) {
            char[] second = console.readPassword("%s", "Password to hash (confirm): ");
            if (!Arrays.equals(first, second)) {
                String msg = "Password entries do not match.";
                throw new IllegalArgumentException(msg);
            }
        }
        return first;
    }
Commandline line utility to hash data such as strings, passwords, resources (files, urls, etc.).
<p/>
Usage:
<pre>
java -jar shiro-tools-hasher<em>-version</em>-cli.jar
</pre>
This will print out all supported options with documentation.

@since 1.2
tools/hasher/src/main/java/org/apache/shiro/tools/hasher/Hasher.java