public final class ChaChaCore extends Object
Modifier and Type | Method and Description |
---|---|
static void |
hash(int[] output,
int[] input)
Hashes an input block with ChaCha20.
|
static void |
initIV(int[] output,
long iv)
Initializes the 64-bit initialization vector in a ChaCha20 block.
|
static void |
initKey256(int[] output,
byte[] key,
int offset)
Initializes a ChaCha20 block with a 256-bit key.
|
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.
|
public static void hash(int[] output, int[] input)
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.public static void initKey256(int[] output, byte[] key, int offset)
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.public static void initIV(int[] output, long iv)
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.public static void xorBlock(byte[] input, int inputOffset, byte[] output, int outputOffset, int length, int[] block)
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.