src/share/classes/sun/security/provider/SHA.java
Print this page
@@ -45,14 +45,14 @@
// Buffer of int's and count of characters accumulated
// 64 bytes are included in each hash block so the low order
// bits of count are used to know how to pack the bytes into ints
// and to know when to compute the block and start the next one.
- private final int[] W;
+ private int[] W;
// state of this
- private final int[] state;
+ private int[] state;
/**
* Creates a new SHA object.
*/
public SHA() {
@@ -60,23 +60,18 @@
state = new int[5];
W = new int[80];
implReset();
}
- /**
- * Creates a SHA object.with state (for cloning) */
- private SHA(SHA base) {
- super(base);
- this.state = base.state.clone();
- this.W = new int[80];
- }
-
/*
* Clones this object.
*/
- public Object clone() {
- return new SHA(this);
+ public Object clone() throws CloneNotSupportedException {
+ SHA copy = (SHA) super.clone();
+ copy.state = copy.state.clone();
+ copy.W = new int[80];
+ return copy;
}
/**
* Resets the buffers and hash value to start a new hash.
*/