public static class ChaCha20Poly1305.Poly1305 extends Object
Poly1305 computes a 128-bit (16 bytes) authenticator, using a 128 bit nonce and a 256 bit key consisting of a 128 bit key applied to an underlying cipher, and a 128 bit key (with 106 effective key bits) used in the authenticator.
The polynomial calculation in this implementation is adapted from the public domain poly1305-donna-unrolled C implementation by Andrew M (@floodyberry).
Poly1305KeyGenerator
Constructor and Description |
---|
Poly1305()
Constructs a Poly1305 MAC, where the key passed to init() will be used directly.
|
Modifier and Type | Method and Description |
---|---|
int |
doFinal(byte[] out,
int outOff) |
String |
getAlgorithmName() |
int |
getMacSize() |
void |
init(byte[] key)
Initialises the Poly1305 MAC.
|
void |
reset() |
void |
update(byte in) |
void |
update(byte[] in,
int inOff,
int len) |
public Poly1305()
public void init(byte[] key) throws IllegalArgumentException
params
- if used with a block cipher, then a ParametersWithIV
containing a 128 bit
nonce and a KeyParameter
with a 256 bit key complying to the
Poly1305 key format
, otherwise just the
KeyParameter
.IllegalArgumentException
public String getAlgorithmName()
public int getMacSize()
public void update(byte in) throws IOException, IllegalStateException
IOException
IllegalStateException
public void update(byte[] in, int inOff, int len) throws IOException, IllegalStateException
IOException
IllegalStateException
public int doFinal(byte[] out, int outOff) throws IOException, IllegalStateException
IOException
IllegalStateException
public void reset()
Copyright © 2024. All rights reserved.