Class Poly1305Mac

java.lang.Object
org.apache.sshd.common.mac.Poly1305Mac
All Implemented Interfaces:
AlgorithmNameProvider, Mac, MacInformation

public class Poly1305Mac extends Object implements Mac
Poly1305 one-time message authentication code. This implementation is derived from the public domain C library poly1305-donna.
See Also:
  • Field Details

    • KEY_BYTES

      public static final int KEY_BYTES
      See Also:
    • BLOCK_SIZE

      private static final int BLOCK_SIZE
      See Also:
    • r0

      private int r0
    • r1

      private int r1
    • r2

      private int r2
    • r3

      private int r3
    • r4

      private int r4
    • s1

      private int s1
    • s2

      private int s2
    • s3

      private int s3
    • s4

      private int s4
    • k0

      private int k0
    • k1

      private int k1
    • k2

      private int k2
    • k3

      private int k3
    • h0

      private int h0
    • h1

      private int h1
    • h2

      private int h2
    • h3

      private int h3
    • h4

      private int h4
    • currentBlock

      private final byte[] currentBlock
    • currentBlockOffset

      private int currentBlockOffset
  • Constructor Details

    • Poly1305Mac

      public Poly1305Mac()
  • Method Details

    • getAlgorithm

      public String getAlgorithm()
      Specified by:
      getAlgorithm in interface AlgorithmNameProvider
    • init

      public void init(byte[] key) throws Exception
      Specified by:
      init in interface Mac
      Throws:
      Exception
    • update

      public void update(byte[] in, int offset, int length)
      Specified by:
      update in interface Mac
    • updateUInt

      public void updateUInt(long value)
      Specified by:
      updateUInt in interface Mac
    • doFinal

      public void doFinal(byte[] out, int offset) throws Exception
      Specified by:
      doFinal in interface Mac
      Throws:
      Exception
    • processBlock

      private void processBlock()
    • reset

      private void reset()
    • getBlockSize

      public int getBlockSize()
      Specified by:
      getBlockSize in interface MacInformation
      Returns:
      MAC output block size in bytes - may be less than the default - e.g., MD5-96
    • getDefaultBlockSize

      public int getDefaultBlockSize()
      Specified by:
      getDefaultBlockSize in interface MacInformation
      Returns:
      The "natural" MAC block size in bytes
    • unpackIntLE

      private static int unpackIntLE(byte[] buf, int off)
    • packIntLE

      private static void packIntLE(int value, byte[] dst, int off)
    • unsignedProduct

      private static long unsignedProduct(int i1, int i2)