org.bouncycastle.crypto.engines

## Class XChaCha20Engine

- java.lang.Object
- - org.bouncycastle.crypto.engines.Salsa20Engine
  - - org.bouncycastle.crypto.engines.ChaCha7539Engine
    - - org.bouncycastle.crypto.engines.XChaCha20Engine

- All Implemented Interfaces:
    SkippingCipher, SkippingStreamCipher, StreamCipher

      public class XChaCha20Engine
      extends ChaCha7539Engine

  Implementation of the XChaCha20 stream cipher (extended-nonce ChaCha20) as described in draft-irtf-cfrg-xchacha-03.

  XChaCha20 takes a 256 bit key and a 192 bit nonce. The first 128 bits of the nonce are used together with the key in HChaCha20 to derive a 256 bit subkey; that subkey, together with the remaining 64 bits of the nonce (prefixed by four zero bytes to form a 96 bit IETF nonce), then drives a standard ChaCha20-IETF stream as defined by RFC 7539.

- - ### Field Summary

    - ### Fields inherited from class org.bouncycastle.crypto.engines.Salsa20Engine

      `DEFAULT_ROUNDS, engineState, rounds, sigma, tau, x`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XChaCha20Engine()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getAlgorithmName()` Return the name of the algorithm the cipher implements.
    `protected int` | `getNonceSize()`
    `protected void` | `setKey(byte[] keyBytes, byte[] ivBytes)`

    - ### Methods inherited from class org.bouncycastle.crypto.engines.ChaCha7539Engine

      `advanceCounter, advanceCounter, generateKeyStream, getCounter, resetCounter, retreatCounter, retreatCounter`

    - ### Methods inherited from class org.bouncycastle.crypto.engines.Salsa20Engine

      `getPosition, init, packTauOrSigma, processBytes, reset, returnByte, salsaCore, seekTo, skip`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XChaCha20Engine

          public XChaCha20Engine()

  - ### Method Detail

    - #### getAlgorithmName

          public java.lang.String getAlgorithmName()

      Description copied from interface: `StreamCipher`
      Return the name of the algorithm the cipher implements.
      Specified by:
        `getAlgorithmName` in interface `StreamCipher`
      Overrides:
        `getAlgorithmName` in class `ChaCha7539Engine`
      Returns:
        the name of the algorithm the cipher implements.

    - #### getNonceSize

          protected int getNonceSize()

      Overrides:
        `getNonceSize` in class `ChaCha7539Engine`

    - #### setKey

          protected void setKey(byte[] keyBytes,
                                byte[] ivBytes)

      Overrides:
        `setKey` in class `ChaCha7539Engine`