Class ChaChaCore
- java.lang.Object
-
- com.southernstorm.noise.crypto.chacha20.ChaChaCore
-
public final class ChaChaCore extends Object
Implementation of the ChaCha20 core hash transformation.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidhash(int[] output, int[] input)Hashes an input block with ChaCha20.static voidinitIV(int[] output, long iv)Initializes the 64-bit initialization vector in a ChaCha20 block.static voidinitIV(int[] output, long iv, long counter)Initializes the 64-bit initialization vector and counter in a ChaCha20 block.static voidinitKey256(int[] output, byte[] key, int offset)Initializes a ChaCha20 block with a 256-bit key.static voidxorBlock(byte[] input, int inputOffset, byte[] output, int outputOffset, int length, int[] block)XOR's the output of ChaCha20 with a byte buffer.
-
-
-
Method Detail
-
hash
public static void hash(int[] output, int[] input)Hashes an input block with ChaCha20.- Parameters:
output- The output block, which must contain at least 16 elements and must not overlap with the input.input- The input block, which must contain at least 16 elements.
-
initKey256
public static void initKey256(int[] output, byte[] key, int offset)Initializes a ChaCha20 block with a 256-bit key.- Parameters:
output- The output block, which must consist of at least 16 words.key- The buffer containing the key.offset- Offset of the key in the buffer.
-
initIV
public static void initIV(int[] output, long iv)Initializes the 64-bit initialization vector in a ChaCha20 block.- Parameters:
output- The output block, which must consist of at least 16 words and must have been initialized by initKey256() or initKey128().iv- The 64-bit initialization vector value. The counter portion of the output block is set to zero.
-
initIV
public static void initIV(int[] output, long iv, long counter)Initializes the 64-bit initialization vector and counter in a ChaCha20 block.- Parameters:
output- The output block, which must consist of at least 16 words and must have been initialized by initKey256() or initKey128().iv- The 64-bit initialization vector value.counter- The 64-bit counter value.
-
xorBlock
public static void xorBlock(byte[] input, int inputOffset, byte[] output, int outputOffset, int length, int[] block)XOR's the output of ChaCha20 with a byte buffer.- Parameters:
input- The input byte buffer.inputOffset- The offset of the first input byte.output- The output byte buffer (can be the same as the input).outputOffset- The offset of the first output byte.length- The number of bytes to XOR between 1 and 64.block- The ChaCha20 output block.- Since:
- 0.9.39 moved from ChaChaPolyCipherState
-
-