Class XChaCha20Engine
java.lang.Object
org.bouncycastle.crypto.engines.Salsa20Engine
org.bouncycastle.crypto.engines.ChaCha7539Engine
org.bouncycastle.crypto.engines.XChaCha20Engine
- All Implemented Interfaces:
SkippingCipher, SkippingStreamCipher, StreamCipher
Implementation of the XChaCha20 stream cipher (extended-nonce ChaCha20)
as described in draft-irtf-cfrg-xchacha-03.
XChaCha20 takes a 256 bit key and a 192 bit nonce. The first 128 bits of the nonce are used together with the key in HChaCha20 to derive a 256 bit subkey; that subkey, together with the remaining 64 bits of the nonce (prefixed by four zero bytes to form a 96 bit IETF nonce), then drives a standard ChaCha20-IETF stream as defined by RFC 7539.
-
Field Summary
Fields inherited from class 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 intprotected voidsetKey(byte[] keyBytes, byte[] ivBytes) Methods inherited from class ChaCha7539Engine
advanceCounter, advanceCounter, generateKeyStream, getCounter, resetCounter, retreatCounter, retreatCounterMethods inherited from class Salsa20Engine
getPosition, init, packTauOrSigma, processBytes, reset, returnByte, salsaCore, seekTo, skip
-
Constructor Details
-
XChaCha20Engine
public XChaCha20Engine()
-
-
Method Details
-
getAlgorithmName
Description copied from interface:StreamCipherReturn the name of the algorithm the cipher implements.- Specified by:
getAlgorithmNamein interfaceStreamCipher- Overrides:
getAlgorithmNamein classChaCha7539Engine- Returns:
- the name of the algorithm the cipher implements.
-
getNonceSize
protected int getNonceSize()- Overrides:
getNonceSizein classChaCha7539Engine
-
setKey
protected void setKey(byte[] keyBytes, byte[] ivBytes) - Overrides:
setKeyin classChaCha7539Engine
-