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.

  • Constructor Details

    • XSalsa20Engine

      public XSalsa20Engine()
  • Method Details

    • getAlgorithmName

      public 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