Package com.southernstorm.noise.crypto
Class Poly1305
- java.lang.Object
-
- com.southernstorm.noise.crypto.Poly1305
-
- All Implemented Interfaces:
Destroyable
,Cloneable
public final class Poly1305 extends Object implements Destroyable, Cloneable
Simple implementation of the Poly1305 message authenticator.
-
-
Constructor Summary
Constructors Constructor Description Poly1305()
Constructs a new Poly1305 message authenticator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Poly1305
clone()
I2Pvoid
destroy()
Destroys all sensitive state in the current object.void
finish(byte[] token, int offset)
Finishes the message authenticator and returns the 16-byte token.void
pad()
Pads the input with zeroes to a multiple of 16 bytes.void
reset(byte[] key, int offset)
Resets the message authenticator with a new key.void
update(byte[] data, int offset, int length)
Updates the message authenticator with more input data.
-
-
-
Method Detail
-
reset
public void reset(byte[] key, int offset)
Resets the message authenticator with a new key.- Parameters:
key
- The buffer containing the 32 byte key.offset
- The offset into the buffer of the first key byte.
-
update
public void update(byte[] data, int offset, int length)
Updates the message authenticator with more input data.- Parameters:
data
- The buffer containing the input data.offset
- The offset of the first byte of input.length
- The number of bytes of input.
-
pad
public void pad()
Pads the input with zeroes to a multiple of 16 bytes.
-
finish
public void finish(byte[] token, int offset)
Finishes the message authenticator and returns the 16-byte token.- Parameters:
token
- The buffer to receive the token.offset
- The offset of the token in the buffer.
-
destroy
public void destroy()
Description copied from interface:Destroyable
Destroys all sensitive state in the current object.- Specified by:
destroy
in interfaceDestroyable
-
clone
public Poly1305 clone() throws CloneNotSupportedException
I2P- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
- Since:
- 0.9.44
-
-