/** * 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); } }
/** * 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; }
/* * 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; }
/** * 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; }
/* * 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; }