Class BaseMac

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String algorithm  
      private int bsize  
      private int defbsize  
      private boolean etmMode  
      private javax.crypto.Mac mac  
      private java.lang.String s  
      private byte[] tmp  
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseMac​(java.lang.String algorithm, int bsize, int defbsize, boolean etmMode)  
    • Field Detail

      • algorithm

        private final java.lang.String algorithm
      • defbsize

        private final int defbsize
      • bsize

        private final int bsize
      • tmp

        private final byte[] tmp
      • etmMode

        private final boolean etmMode
      • mac

        private javax.crypto.Mac mac
      • s

        private java.lang.String s
    • Constructor Detail

      • BaseMac

        public BaseMac​(java.lang.String algorithm,
                       int bsize,
                       int defbsize,
                       boolean etmMode)
    • Method Detail

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

        public void init​(byte[] key)
                  throws java.lang.Exception
        Specified by:
        init in interface Mac
        Throws:
        java.lang.Exception
      • updateUInt

        public void updateUInt​(long i)
        Specified by:
        updateUInt in interface Mac
      • update

        public void update​(byte[] buf,
                           int offset,
                           int len)
        Specified by:
        update in interface Mac
      • doFinal

        public void doFinal​(byte[] buf,
                            int offset)
                     throws java.lang.Exception
        Specified by:
        doFinal in interface Mac
        Throws:
        java.lang.Exception
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object