equal
deleted
inserted
replaced
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package sun.security.provider; |
26 package sun.security.provider; |
27 |
27 |
|
28 import java.util.Arrays; |
28 import java.util.Objects; |
29 import java.util.Objects; |
29 |
30 |
30 import static sun.security.provider.ByteArrayAccess.*; |
31 import static sun.security.provider.ByteArrayAccess.*; |
31 import jdk.internal.HotSpotIntrinsicCandidate; |
32 import jdk.internal.HotSpotIntrinsicCandidate; |
32 |
33 |
60 */ |
61 */ |
61 public SHA() { |
62 public SHA() { |
62 super("SHA-1", 20, 64); |
63 super("SHA-1", 20, 64); |
63 state = new int[5]; |
64 state = new int[5]; |
64 W = new int[80]; |
65 W = new int[80]; |
65 implReset(); |
66 resetHashes(); |
66 } |
67 } |
67 |
68 |
68 /* |
69 /* |
69 * Clones this object. |
70 * Clones this object. |
70 */ |
71 */ |
77 |
78 |
78 /** |
79 /** |
79 * Resets the buffers and hash value to start a new hash. |
80 * Resets the buffers and hash value to start a new hash. |
80 */ |
81 */ |
81 void implReset() { |
82 void implReset() { |
|
83 // Load magic initialization constants. |
|
84 resetHashes(); |
|
85 // clear out old data |
|
86 Arrays.fill(W, 0); |
|
87 } |
|
88 |
|
89 private void resetHashes() { |
82 state[0] = 0x67452301; |
90 state[0] = 0x67452301; |
83 state[1] = 0xefcdab89; |
91 state[1] = 0xefcdab89; |
84 state[2] = 0x98badcfe; |
92 state[2] = 0x98badcfe; |
85 state[3] = 0x10325476; |
93 state[3] = 0x10325476; |
86 state[4] = 0xc3d2e1f0; |
94 state[4] = 0xc3d2e1f0; |