org.bouncycastle.crypto.engines
Class ChaChaEngine
java.lang.Object
|
+--org.bouncycastle.crypto.engines.Salsa20Engine
|
+--org.bouncycastle.crypto.engines.ChaChaEngine
- All Implemented Interfaces:
- SkippingCipher, SkippingStreamCipher, StreamCipher
- public class ChaChaEngine
- extends Salsa20Engine
Implementation of Daniel J. Bernstein's ChaCha stream cipher.
Constructor Summary |
ChaChaEngine()
Creates a 20 rounds ChaCha engine. |
ChaChaEngine(int rounds)
Creates a ChaCha engine with a specific number of rounds. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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).
getAlgorithmName
public java.lang.String getAlgorithmName()
- Description copied from interface:
StreamCipher
- Return the name of the algorithm the cipher implements.
- Overrides:
getAlgorithmName
in class Salsa20Engine
- Following copied from interface:
org.bouncycastle.crypto.StreamCipher
- Returns:
- the name of the algorithm the cipher implements.
advanceCounter
protected void advanceCounter(long diff)
- Overrides:
advanceCounter
in class Salsa20Engine
advanceCounter
protected void advanceCounter()
- Overrides:
advanceCounter
in class Salsa20Engine
retreatCounter
protected void retreatCounter(long diff)
- Overrides:
retreatCounter
in class Salsa20Engine
retreatCounter
protected void retreatCounter()
- Overrides:
retreatCounter
in class Salsa20Engine
getCounter
protected long getCounter()
- Overrides:
getCounter
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)
- ChaCha function
- Parameters:
input
- input data