src/share/classes/sun/security/provider/DigestBase.java

Print this page

        

*** 37,47 **** * implement the following methods: * * . abstract void implCompress(byte[] b, int ofs); * . abstract void implDigest(byte[] out, int ofs); * . abstract void implReset(); - * . public abstract Object clone(); * * See the inline documentation for details. * * @since 1.5 * @author Andreas Sterbenz --- 37,46 ----
*** 59,69 **** // size of the input to the compression function in bytes private final int blockSize; // buffer to store partial blocks, blockSize bytes large // Subclasses should not access this array directly except possibly in their // implDigest() method. See MD5.java as an example. ! final byte[] buffer; // offset into buffer private int bufOfs; // number of bytes processed so far. subclasses should not modify // this value. --- 58,68 ---- // size of the input to the compression function in bytes private final int blockSize; // buffer to store partial blocks, blockSize bytes large // Subclasses should not access this array directly except possibly in their // implDigest() method. See MD5.java as an example. ! byte[] buffer; // offset into buffer private int bufOfs; // number of bytes processed so far. subclasses should not modify // this value.
*** 81,102 **** this.digestLength = digestLength; this.blockSize = blockSize; buffer = new byte[blockSize]; } - /** - * Constructor for cloning. Replicates common data. - */ - DigestBase(DigestBase base) { - this.algorithm = base.algorithm; - this.digestLength = base.digestLength; - this.blockSize = base.blockSize; - this.buffer = base.buffer.clone(); - this.bufOfs = base.bufOfs; - this.bytesProcessed = base.bytesProcessed; - } - // return digest length. See JCA doc. protected final int engineGetDigestLength() { return digestLength; } --- 80,89 ----
*** 204,219 **** * Reset subclass specific state to their initial values. DigestBase * calls this method when necessary. */ abstract void implReset(); ! /** ! * Clone this digest. Should be implemented as "return new MyDigest(this)". ! * That constructor should first call "super(baseDigest)" and then copy ! * subclass specific data. ! */ ! public abstract Object clone(); // padding used for the MD5, and SHA-* message digests static final byte[] padding; static { --- 191,205 ---- * Reset subclass specific state to their initial values. DigestBase * calls this method when necessary. */ abstract void implReset(); ! public Object clone() throws CloneNotSupportedException { ! DigestBase copy = (DigestBase) super.clone(); ! copy.buffer = copy.buffer.clone(); ! return copy; ! } // padding used for the MD5, and SHA-* message digests static final byte[] padding; static {
*** 221,227 **** // and an additional 8 bytes for the high 8 bytes of the 16 // byte bit counter in SHA-384/512 padding = new byte[136]; padding[0] = (byte)0x80; } - } --- 207,212 ----