private SecretKeySpec secretKeySpec(SecretKeyFactory keyFactory,
                                        String cipherAlg,
                                        int keyLength,
                                        byte[] salt,
                                        int iterations) throws InvalidKeySpecException {
        PBEKeySpec keySpec = new PBEKeySpec(secret.value().toCharArray(), salt, iterations, keyLength);
        String algorithm = (cipherAlg.indexOf('/') > 0) ? cipherAlg.substring(0, cipherAlg.indexOf('/')) : cipherAlg;
        return new SecretKeySpec(keyFactory.generateSecret(keySpec).getEncoded(), algorithm);
    }
@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