Class Poly1305


  • public class Poly1305
    extends java.lang.Object
    Poly1305 one-time MAC based on RFC 7539.

    This is not an implementation of the MAC interface on purpose and it is not equivalent to HMAC.

    The implementation is based on poly1305 implementation by Andrew Moon (https://github.com/floodyberry/poly1305-donna) and released as public domain.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] computeMac​(byte[] key, byte[] data)
      Computes Poly1305 MAC over data using key.
      static void verifyMac​(byte[] key, byte[] data, byte[] mac)
      Verifies Poly1305 {@ mac} over data using key.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • computeMac

        public static byte[] computeMac​(byte[] key,
                                        byte[] data)
        Computes Poly1305 MAC over data using key.
      • verifyMac

        public static void verifyMac​(byte[] key,
                                     byte[] data,
                                     byte[] mac)
                              throws java.security.GeneralSecurityException
        Verifies Poly1305 {@ mac} over data using key.
        Throws:
        java.security.GeneralSecurityException