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

  • 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
    • 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

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

      public static void packIntLE(int value, byte[] dst, int off)