code: public OutputStream encrypt(OutputStream destination, String password) throws IOException {
  
          // Basic null check.
          // An empty stream can be encrypted:
          if (destination == null) {
              return null;
          }
  
          String salt = Generate.salt();
          SecretKey key = Keys.generateSecretKey(password, salt);
  
          // The key generation salt can be stored unencrypted at the start of the
          // stream:
          destination.write(ByteArray.fromBase64(salt));
  
          // Return the initialised stream:
          return encrypt(destination, key);
      }
docs: This method wraps the destination {@link OutputStream} with a
  {@link CipherOutputStream}.
  <p>
  Typical usage is when you have an InputStream for a source of unencrypted
  data, such as a user-uploaded file, and an OutputStream to write the
  input to disk. You would call this method to wrap the OutputStream and
  use the returned {@link CipherOutputStream} instead to write the data to,
  so that it is encrypted as it is written to disk.
  <p>
  Note that this method writes a salt value and an initialisation vector to
  the destination OutputStream, so the destination parameter will have some
  bytes written to it before this method returns. These bytes are necessary
  for initialising encryption and a corresponding call to
  {@link #decrypt(InputStream, String)} will read and filter them out from
  the underlying InputStream before returning it.
  
  @param destination The output stream to be wrapped with a
  {@link CipherOutputStream}.
  @param password    The password to be used to generate a key to encrypt data
  written to the returned {@link CipherOutputStream}.
  @return A {@link CipherOutputStream}, which wraps the given
  {@link OutputStream}.
  @throws IOException              If an error occurs in writing the initialisation vector to
  the destination stream.
  @throws IllegalArgumentException If the given key is not a valid {@value #CIPHER_ALGORITHM}
  key.
  @see #decrypt(InputStream, String)