src/java.base/share/classes/sun/security/provider/MD4.java
changeset 51504 c9a3e3cac9c7
parent 47216 71c04702a3d5
child 57950 4612a3cfb927
equal deleted inserted replaced
51503:0265a70ea2a5 51504:c9a3e3cac9c7
    24  */
    24  */
    25 
    25 
    26 package sun.security.provider;
    26 package sun.security.provider;
    27 
    27 
    28 import java.security.*;
    28 import java.security.*;
       
    29 import java.util.Arrays;
    29 
    30 
    30 import static sun.security.provider.ByteArrayAccess.*;
    31 import static sun.security.provider.ByteArrayAccess.*;
    31 import static sun.security.util.SecurityConstants.PROVIDER_VER;
    32 import static sun.security.util.SecurityConstants.PROVIDER_VER;
    32 
    33 
    33 /**
    34 /**
    90     // Standard constructor, creates a new MD4 instance.
    91     // Standard constructor, creates a new MD4 instance.
    91     public MD4() {
    92     public MD4() {
    92         super("MD4", 16, 64);
    93         super("MD4", 16, 64);
    93         state = new int[4];
    94         state = new int[4];
    94         x = new int[16];
    95         x = new int[16];
    95         implReset();
    96         resetHashes();
    96     }
    97     }
    97 
    98 
    98     // clone this object
    99     // clone this object
    99     public Object clone() throws CloneNotSupportedException {
   100     public Object clone() throws CloneNotSupportedException {
   100         MD4 copy = (MD4) super.clone();
   101         MD4 copy = (MD4) super.clone();
   106     /**
   107     /**
   107      * Reset the state of this object.
   108      * Reset the state of this object.
   108      */
   109      */
   109     void implReset() {
   110     void implReset() {
   110         // Load magic initialization constants.
   111         // Load magic initialization constants.
       
   112         resetHashes();
       
   113         // clear out old data
       
   114         Arrays.fill(x, 0);
       
   115     }
       
   116 
       
   117     private void resetHashes() {
   111         state[0] = 0x67452301;
   118         state[0] = 0x67452301;
   112         state[1] = 0xefcdab89;
   119         state[1] = 0xefcdab89;
   113         state[2] = 0x98badcfe;
   120         state[2] = 0x98badcfe;
   114         state[3] = 0x10325476;
   121         state[3] = 0x10325476;
   115     }
   122     }