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 and Description
    `Poly1305()` Constructs a new Poly1305 message authenticator.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Poly1305` | `clone()` I2P
    `void` | `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.

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Poly1305

          public Poly1305()

      Constructs a new Poly1305 message authenticator.

  - ### Method Detail

    - #### clone

          public Poly1305 clone()
                         throws CloneNotSupportedException

      I2P
      Overrides:
        `clone` in class `Object`
      Throws:
        `CloneNotSupportedException`

    - #### destroy

          public void destroy()

      Description copied from interface: `Destroyable`
      Destroys all sensitive state in the current object.
      Specified by:
        `destroy` in interface `Destroyable`

    - #### 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.

    - #### pad

          public void pad()

      Pads the input with zeroes to a multiple of 16 bytes.

    - #### 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.