@Override
    public String toBase64() {
        if (this.base64Encoded == null) {
            //cache result in case this method is called multiple times.
            this.base64Encoded = Base64.encodeToString(this.formatToCryptString().getBytes(StandardCharsets.UTF_8));
        }
        return this.base64Encoded;
    }
Returns a Base64-encoded string of the underlying {@link #formatToCryptString()} formatted output}.
<p/>
This implementation caches the resulting Base64 string so multiple calls to this method remain efficient.

@return a Base64-encoded string of the underlying {@link #formatToCryptString()} formatted output}.
crypto/hash/src/main/java/org/apache/shiro/crypto/hash/AbstractCryptHash.java