docs: static SecretKey generateSecretKey(String password, String salt) {
  
          if (password == null) {
              return null;
          }
  
          // Get a SecretKeyFactory for ALGORITHM.
          // If PBKDF2WithHmacSHA256, add BouncyCastle and recurse to retry.
          SecretKeyFactory factory;
          try {
              factory = SecretKeyFactory.getInstance(SYMMETRIC_PASSWORD_ALGORITHM);
          } catch (NoSuchAlgorithmException e) {
              if (SecurityProvider.addProvider()) {
                  // Retry
                  return generateSecretKey(password, salt);
              } else {
                  throw new IllegalStateException("Algorithm unavailable: " + SYMMETRIC_PASSWORD_ALGORITHM, e);
              }
          }
  
          // Generate the key:
          byte[] saltBytes = ByteArray.fromBase64(salt);
          PBEKeySpec pbeKeySpec = new PBEKeySpec(password.toCharArray(), saltBytes, SYMMETRIC_PASSWORD_ITERATIONS, SYMMETRIC_KEY_SIZE);
          SecretKey key;
          try {
              key = factory.generateSecret(pbeKeySpec);
          } catch (InvalidKeySpecException e) {
              throw new IllegalStateException("Error generating password-based key.", e);
          }
  
          // NB: At this point, key.getAlgorithm() returns PBKDF2WithHmacSHA256,
          // rather than AES, so create a new SecretKeySpec with the correct
          // Algorithm.
          // For an example of someone using this method, see:
          // http://stackoverflow.com/questions/2860943/suggestions-for-library-to-hash-passwords-in-java
          return new SecretKeySpec(key.getEncoded(), SYMMETRIC_ALGORITHM);
      }