예제 #1
0
        /**
         * Returns the engine digest length in bytes. If the implementation does not
         * implement this function or is not an instance of {@code Cloneable},
         * {@code 0} is returned.
         *
         * @return the digest length in bytes, or {@code 0}
         */
        public int getDigestLength()
        {
            int l = engineGetDigestLength();

            if (l != 0)
            {
                return(l);
            }
            if (!(this is java.lang.Cloneable))
            {
                return(0);
            }
            try
            {
                MessageDigest md = (MessageDigest)clone();
                return(md.digest().Length);
            }
            catch (java.lang.CloneNotSupportedException)
            {
                return(0);
            }
        }
예제 #2
0
 /**
  * Constructs a new instance of this {@code DigestInputStream}, using the
  * given {@code stream} and the {@code digest}.
  *
  * @param stream
  *            the input stream.
  * @param digest
  *            the message digest.
  */
 public DigestInputStream(java.io.InputStream stream, MessageDigest digest)
     : base(stream)
 {
     this.digest = digest;
 }
예제 #3
0
 /*
  * Sets the message digest which this stream will use.
  *
  * @param digest
  *            the message digest which this stream will use.
  */
 public void setMessageDigest(MessageDigest digest)
 {
     this.digest = digest;
 }
예제 #4
0
 /**
  * Sets the message digest which this stream will use.
  *
  * @param digest
  *            the message digest which this stream will use.
  */
 public void setMessageDigest(MessageDigest digest)
 {
     this.digest = digest;
 }
예제 #5
0
 /*
  * Constructs a new instance of this {@code DigestInputStream}, using the
  * given {@code stream} and the {@code digest}.
  *
  * @param stream
  *            the input stream.
  * @param digest
  *            the message digest.
  */
 public DigestInputStream(java.io.InputStream stream, MessageDigest digest) :
     base(stream)
 {
     this.digest = digest;
 }