@Override
  public byte[] encrypt(final byte[] plaintext) throws GeneralSecurityException {
    ByteBuffer output = ByteBuffer.allocate(NONCE_LENGTH_IN_BYTES + plaintext.length);
    byte[] nonce = Random.randBytes(NONCE_LENGTH_IN_BYTES);
    output.put(nonce); // Prepend nonce to ciphertext output.
    cipher.encrypt(output, nonce, plaintext);
    return output.array();
  }
A stream cipher, as described in RFC 8439 https://tools.ietf.org/html/rfc8439, section 2.4.

<p>This cipher is meant to be used to construct an AEAD with Poly1305.
java_src/src/main/java/com/google/crypto/tink/subtle/ChaCha20.java