private SecretKeyFactory secretKeyFactory(String keyFactoryAlg) throws NoSuchAlgorithmException {
        if (keyFactoryAlg != null) {
            return SecretKeyFactory.getInstance(keyFactoryAlg);
        } else {
            try {
                return SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512");
            } catch (NoSuchAlgorithmException nsae) {
                return SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
            }
        }
    }
@param secret The secret used for encoding and decoding
@param keyFactoryAlgorithm  Key factory algorithm if configured. By default, PBKDF2WithHmacSHA512 is
                            used if available, PBKDF2WithHmacSHA1 otherwise.
@param cipherAlgorithm Cipher algorithm used for encoding.
@param keyLength Key length used for encoding. This should be valid for the specified algorithms.
@param iterations Iteration count used for encoding.
The provided `keyFactoryAlgorithm`, `cipherAlgorithm`, `keyLength` and `iterations` are used for encoding passwords.
The values used for encoding are stored along with the encoded password and the stored values are used for decoding.
server-common/src/main/java/org/apache/kafka/security/EncryptingPasswordEncoder.java