XSalsa20Engine (Bouncy Castle Library 1.52 API Specification)

org.bouncycastle.crypto.engines

## Class XSalsa20Engine

- java.lang.Object
- - org.bouncycastle.crypto.engines.Salsa20Engine
  - - org.bouncycastle.crypto.engines.XSalsa20Engine

- All Implemented Interfaces:
    SkippingCipher, SkippingStreamCipher, StreamCipher

      public class XSalsa20Engine
      extends Salsa20Engine

  Implementation of Daniel J. Bernstein's XSalsa20 stream cipher - Salsa20 with an extended nonce.

  XSalsa20 requires a 256 bit key, and a 192 bit nonce.

- - ### Field Summary

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

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XSalsa20Engine()`

  - ### Method Summary

    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)` XSalsa20 key generation: process 256 bit input key and 128 bits of the input nonce using a core Salsa20 function without input addition to produce 256 bit working key and use that with the remaining 64 bits of nonce to initialize a standard Salsa20 engine state.

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

      `advanceCounter, advanceCounter, generateKeyStream, getCounter, getPosition, init, processBytes, reset, resetCounter, retreatCounter, retreatCounter, returnByte, rotl, salsaCore, seekTo, skip`

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

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

- - ### Constructor Detail

    - #### XSalsa20Engine

          public XSalsa20Engine()

  - ### 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 `Salsa20Engine`
      Returns:
        the name of the algorithm the cipher implements.

    - #### getNonceSize

          protected int getNonceSize()

      Overrides:
        `getNonceSize` in class `Salsa20Engine`

    - #### setKey

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

      XSalsa20 key generation: process 256 bit input key and 128 bits of the input nonce using a core Salsa20 function without input addition to produce 256 bit working key and use that with the remaining 64 bits of nonce to initialize a standard Salsa20 engine state.
      Overrides:
        `setKey` in class `Salsa20Engine`