SunUnixMD5CryptPasswordImpl(final ClearPasswordSpec spec) throws NoSuchAlgorithmException {
   this.algorithm = ALGORITHM_SUN_CRYPT_MD5;
   this.salt = PasswordUtil.generateRandomSalt(DEFAULT_SALT_SIZE);
   this.iterationCount = DEFAULT_ITERATION_COUNT;
   this.hash =
       sunMD5Crypt(
           algorithm, getNormalizedPasswordBytes(spec.getEncodedPassword()), salt, iterationCount);
 }
 private SunUnixMD5CryptPasswordImpl(
     final String algorithm, final char[] password, final IteratedSaltedPasswordAlgorithmSpec spec)
     throws NoSuchAlgorithmException {
   this(
       algorithm,
       password,
       spec.getSalt() == null
           ? PasswordUtil.generateRandomSalt(DEFAULT_SALT_SIZE)
           : spec.getSalt().clone(),
       spec.getIterationCount());
 }