Class BaseDigest

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String algorithm  
      private int bsize  
      private int h  
      private java.security.MessageDigest md  
      private java.lang.String s  
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseDigest​(java.lang.String algorithm, int bsize)
      Create a new digest using the given algorithm and block size.
    • Field Detail

      • algorithm

        private final java.lang.String algorithm
      • bsize

        private final int bsize
      • h

        private int h
      • s

        private java.lang.String s
      • md

        private java.security.MessageDigest md
    • Constructor Detail

      • BaseDigest

        public BaseDigest​(java.lang.String algorithm,
                          int bsize)
        Create a new digest using the given algorithm and block size. The initialization and creation of the underlying MessageDigest object will be done in the init() method.
        Parameters:
        algorithm - the JCE algorithm to use for this digest
        bsize - the block size of this digest
    • Method Detail

      • getBlockSize

        public int getBlockSize()
        Specified by:
        getBlockSize in interface DigestInformation
        Returns:
        The number of bytes in the digest's output
      • init

        public void init()
                  throws java.lang.Exception
        Specified by:
        init in interface Digest
        Throws:
        java.lang.Exception
      • update

        public void update​(byte[] data)
                    throws java.lang.Exception
        Specified by:
        update in interface Digest
        Throws:
        java.lang.Exception
      • update

        public void update​(byte[] data,
                           int start,
                           int len)
                    throws java.lang.Exception
        Specified by:
        update in interface Digest
        Throws:
        java.lang.Exception
      • getMessageDigest

        protected java.security.MessageDigest getMessageDigest()
        Returns:
        The current MessageDigest - may be null if init() not called
      • digest

        public byte[] digest()
                      throws java.lang.Exception
        Specified by:
        digest in interface Digest
        Throws:
        java.lang.Exception
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(Digest that)
        Specified by:
        compareTo in interface java.lang.Comparable<Digest>
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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