Class ChaCha20Cipher.ChaChaEngine
java.lang.Object
org.apache.sshd.common.cipher.ChaCha20Cipher.ChaChaEngine
- Enclosing class:
ChaCha20Cipher
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final int[]protected final int[]protected longprivate static final intprivate static final intprivate static final intprotected final byte[]protected final byte[]private static final intprotected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidcrypt(byte[] in, int offset, int length, byte[] out, int outOffset) protected voidinitCounter(long counter) protected voidinitKey(byte[] key) protected voidinitNonce(byte[] nonce) protected byte[]polyKey()protected voidsetKeyStream(int[] engine) private static voidunpackIntsLE(byte[] buf, int off, int nrInts, int[] dst, int dstOff) private static int[]unpackSigmaString(byte[] buf)
-
Field Details
-
BLOCK_BYTES
private static final int BLOCK_BYTES- See Also:
-
BLOCK_INTS
private static final int BLOCK_INTS- See Also:
-
KEY_OFFSET
private static final int KEY_OFFSET- See Also:
-
KEY_BYTES
private static final int KEY_BYTES- See Also:
-
KEY_INTS
private static final int KEY_INTS- See Also:
-
COUNTER_OFFSET
private static final int COUNTER_OFFSET- See Also:
-
NONCE_OFFSET
private static final int NONCE_OFFSET- See Also:
-
ENGINE_STATE_HEADER
private static final int[] ENGINE_STATE_HEADER -
engineState
protected final int[] engineState -
keyStream
protected final byte[] keyStream -
nonce
protected final byte[] nonce -
initialNonce
protected long initialNonce -
nonceVal
protected long nonceVal
-
-
Constructor Details
-
ChaChaEngine
protected ChaChaEngine()
-
-
Method Details
-
initKey
protected void initKey(byte[] key) -
initNonce
protected void initNonce(byte[] nonce) -
advanceNonce
protected void advanceNonce() -
initCounter
protected void initCounter(long counter) -
crypt
protected void crypt(byte[] in, int offset, int length, byte[] out, int outOffset) -
polyKey
protected byte[] polyKey() -
setKeyStream
protected void setKeyStream(int[] engine) -
unpackIntsLE
private static void unpackIntsLE(byte[] buf, int off, int nrInts, int[] dst, int dstOff) -
unpackSigmaString
private static int[] unpackSigmaString(byte[] buf)
-