@Test
  public void pbkdf2KeyWithRandomSaltAndIterationCount() throws Exception {
    byte[] password = PasswordToByteConverter.convert("password");

    PBKDF2Parameters kdfParam1 = new PBKDF2Parameters(16);
    KeyParameter params1 = getKDFInstance(kdfParam1).derive(password);

    PBKDF2Parameters kdfParam2 = new PBKDF2Parameters(16);
    KeyParameter params2 = getKDFInstance(kdfParam2).derive(password);

    assertThat(params1.getKey(), not(equalTo(params2.getKey())));
    assertThat(params1.getKey().length, equalTo(16));
    assertThat(kdfParam1.getSalt(), not(equalTo(kdfParam2.getSalt())));
    assertThat(kdfParam1.getIterationCount(), not(equalTo(kdfParam2.getIterationCount())));
  }
  @Test
  public void pbkdf2KeyWithRandomIterationCount() throws Exception {
    byte[] salt = Hex.decode("12 34 56 78 78 56 34 12");
    byte[] password = PasswordToByteConverter.convert("password");

    PBKDF2Parameters kdfParam1 = new PBKDF2Parameters(24, salt);
    KeyParameter params1 = getKDFInstance(kdfParam1).derive(password);

    PBKDF2Parameters kdfParam2 = new PBKDF2Parameters(24, salt);
    KeyParameter params2 = getKDFInstance(kdfParam2).derive(password);

    assertThat(params1.getKey(), not(equalTo(params2.getKey())));
    assertThat(params1.getKey().length, equalTo(24));
    assertThat(kdfParam1.getSalt(), equalTo(kdfParam2.getSalt()));
    assertThat(kdfParam1.getIterationCount(), not(equalTo(kdfParam2.getIterationCount())));
  }