Class BaseDigest

  • All Implemented Interfaces:
    Digest
    Direct Known Subclasses:
    MD5, SHA1, SHA256, SHA384, SHA512

    public class BaseDigest
    extends java.lang.Object
    implements Digest
    Base class for Digest algorithms based on the JCE provider.
    • Field Summary

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

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] digest()  
      int getBlockSize()  
      void init()  
      void update​(byte[] foo)  
      void update​(byte[] foo, int start, int len)  
      • Methods inherited from class java.lang.Object

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

      • algorithm

        private final java.lang.String algorithm
      • bsize

        private final int bsize
      • 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

      • digest

        public byte[] digest()
        Specified by:
        digest in interface Digest
      • getBlockSize

        public int getBlockSize()
        Specified by:
        getBlockSize in interface Digest
      • init

        public void init()
        Specified by:
        init in interface Digest
      • update

        public void update​(byte[] foo)
        Specified by:
        update in interface Digest
      • update

        public void update​(byte[] foo,
                           int start,
                           int len)
        Specified by:
        update in interface Digest