private static byte[] generateSecretKey(String algorithm, int keyLengthBytes, char[] password) {
    byte[] salt = new byte[keyLengthBytes];
    Bytes.secureRandom(salt);
    PBEKeySpec spec = new PBEKeySpec(password, salt, 10000, keyLengthBytes * 8);
    try {
      return SecretKeyFactory.getInstance(algorithm).generateSecret(spec).getEncoded();
    } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
      throw new RuntimeException(e);
    }
  }
Return a key (byte array) derived from the supplied password argument using the given algorithm
with a random salt at 10,000 iterations.
@param algorithm      the secret key generation algorithm to use
@param keyLengthBytes the length of the key to be derived (in bytes, not in bits)
@param password       char array to use as password for the key generation algorithm
@return secret key encoded as a byte array
hbase-common/src/main/java/org/apache/hadoop/hbase/io/crypto/Encryption.java