Package 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
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 -
Method Summary
Modifier and TypeMethodDescriptionReturn the name of the algorithm the cipher implements.protected int
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, packTauOrSigma, processBytes, reset, resetCounter, retreatCounter, retreatCounter, returnByte, salsaCore, seekTo, skip
-
Constructor Details
-
XSalsa20Engine
public XSalsa20Engine()
-
-
Method Details
-
getAlgorithmName
Description copied from interface:StreamCipher
Return the name of the algorithm the cipher implements.- Specified by:
getAlgorithmName
in interfaceStreamCipher
- Overrides:
getAlgorithmName
in classSalsa20Engine
- Returns:
- the name of the algorithm the cipher implements.
-
getNonceSize
protected int getNonceSize()- Overrides:
getNonceSize
in classSalsa20Engine
-
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 classSalsa20Engine
-