Bouncy Castle Cryptography 1.50

org.bouncycastle.crypto.engines
Class ChaChaEngine

java.lang.Object
  extended by org.bouncycastle.crypto.engines.Salsa20Engine
      extended by org.bouncycastle.crypto.engines.ChaChaEngine
All Implemented Interfaces:
StreamCipher

public class ChaChaEngine
extends Salsa20Engine

Implementation of Daniel J. Bernstein's ChaCha stream cipher.


Field Summary
 
Fields inherited from class org.bouncycastle.crypto.engines.Salsa20Engine
DEFAULT_ROUNDS, engineState, rounds, sigma, tau, x
 
Constructor Summary
ChaChaEngine()
          Creates a 20 rounds ChaCha engine.
ChaChaEngine(int rounds)
          Creates a ChaCha engine with a specific number of rounds.
 
Method Summary
protected  void advanceCounter()
           
static void chachaCore(int rounds, int[] input, int[] x)
          ChacCha function
protected  void generateKeyStream(byte[] output)
           
 java.lang.String getAlgorithmName()
          Return the name of the algorithm the cipher implements.
protected  void resetCounter()
           
protected  void setKey(byte[] keyBytes, byte[] ivBytes)
           
 
Methods inherited from class org.bouncycastle.crypto.engines.Salsa20Engine
getNonceSize, init, processBytes, reset, returnByte, rotl, salsaCore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChaChaEngine

public ChaChaEngine()
Creates a 20 rounds ChaCha engine.


ChaChaEngine

public ChaChaEngine(int rounds)
Creates a ChaCha engine with a specific number of rounds.

Parameters:
rounds - the number of rounds (must be an even number).
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.

advanceCounter

protected void advanceCounter()
Overrides:
advanceCounter in class Salsa20Engine

resetCounter

protected void resetCounter()
Overrides:
resetCounter in class Salsa20Engine

setKey

protected void setKey(byte[] keyBytes,
                      byte[] ivBytes)
Overrides:
setKey in class Salsa20Engine

generateKeyStream

protected void generateKeyStream(byte[] output)
Overrides:
generateKeyStream in class Salsa20Engine

chachaCore

public static void chachaCore(int rounds,
                              int[] input,
                              int[] x)
ChacCha function

Parameters:
input - input data

Bouncy Castle Cryptography 1.50