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

Print this page

        

@@ -37,13 +37,13 @@
  * @author      Andreas Sterbenz
  */
 public final class MD5 extends DigestBase {
 
     // state of this object
-    private final int[] state;
+    private int[] state;
     // temporary buffer, used by implCompress()
-    private final int[] x;
+    private int[] x;
 
     // rotation constants
     private static final int S11 = 7;
     private static final int S12 = 12;
     private static final int S13 = 17;

@@ -67,20 +67,16 @@
         state = new int[4];
         x = new int[16];
         implReset();
     }
 
-    // Cloning constructor
-    private MD5(MD5 base) {
-        super(base);
-        this.state = base.state.clone();
-        this.x = new int[16];
-    }
-
     // clone this object
-    public Object clone() {
-        return new MD5(this);
+    public Object clone() throws CloneNotSupportedException {
+        MD5 copy = (MD5) super.clone();
+        copy.state = copy.state.clone();
+        copy.x = new int[16];
+        return copy;
     }
 
     /**
      * Reset the state of this object.
      */