--- a/src/java.base/share/classes/sun/security/provider/SHA.java Thu Aug 23 10:52:27 2018 +0200
+++ b/src/java.base/share/classes/sun/security/provider/SHA.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 static sun.security.provider.ByteArrayAccess.*;
@@ -62,7 +63,7 @@
super("SHA-1", 20, 64);
state = new int[5];
W = new int[80];
- implReset();
+ resetHashes();
}
/*
@@ -79,6 +80,13 @@
* Resets the buffers and hash value to start a new hash.
*/
void implReset() {
+ // Load magic initialization constants.
+ resetHashes();
+ // clear out old data
+ Arrays.fill(W, 0);
+ }
+
+ private void resetHashes() {
state[0] = 0x67452301;
state[1] = 0xefcdab89;
state[2] = 0x98badcfe;