protected byte[] hash(byte[] bytes, byte[] salt, int hashIterations) throws UnknownAlgorithmException {
        MessageDigest digest = getDigest(getAlgorithmName());
        if (salt != null) {
            digest.reset();
            digest.update(salt);
        }
        byte[] hashed = digest.digest(bytes);
        //already hashed once above
        int iterations = hashIterations - 1;
        //iterate remaining number:
        for (int i = 0; i < iterations; i++) {
            digest.reset();
            hashed = digest.digest(hashed);
        }
        return hashed;
    }
Hashes the specified byte array using the given {@code salt} for the specified number of iterations.

@param bytes          the bytes to hash
@param salt           the salt to use for the initial hash
@param hashIterations the number of times the the {@code bytes} will be hashed (for attack resiliency).
@return the hashed bytes.
@throws UnknownAlgorithmException if the {@link #getAlgorithmName() algorithmName} is not available.
crypto/hash/src/main/java/org/apache/shiro/crypto/hash/AbstractHash.java