--- a/src/java.base/share/classes/sun/security/provider/SHA2.java Thu Aug 23 10:52:27 2018 +0200
+++ b/src/java.base/share/classes/sun/security/provider/SHA2.java Thu Aug 23 11:37:14 2018 +0100
@@ -25,6 +25,7 @@
package sun.security.provider;
+import java.util.Arrays;
import java.util.Objects;
import jdk.internal.HotSpotIntrinsicCandidate;
@@ -83,13 +84,18 @@
this.initialHashes = initialHashes;
state = new int[8];
W = new int[64];
- implReset();
+ resetHashes();
}
/**
* Resets the buffers and hash value to start a new hash.
*/
void implReset() {
+ resetHashes();
+ Arrays.fill(W, 0);
+ }
+
+ private void resetHashes() {
System.arraycopy(initialHashes, 0, state, 0, state.length);
}