--- a/src/java.base/share/classes/sun/security/provider/MD5.java Thu Aug 23 10:52:27 2018 +0200
+++ b/src/java.base/share/classes/sun/security/provider/MD5.java Thu Aug 23 11:37:14 2018 +0100
@@ -25,6 +25,8 @@
package sun.security.provider;
+import java.util.Arrays;
+
import static sun.security.provider.ByteArrayAccess.*;
/**
@@ -66,7 +68,7 @@
super("MD5", 16, 64);
state = new int[4];
x = new int[16];
- implReset();
+ resetHashes();
}
// clone this object
@@ -82,6 +84,12 @@
*/
void implReset() {
// Load magic initialization constants.
+ resetHashes();
+ // clear out old data
+ Arrays.fill(x, 0);
+ }
+
+ private void resetHashes() {
state[0] = 0x67452301;
state[1] = 0xefcdab89;
state[2] = 0x98badcfe;