7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @bug 8035968
27 * @summary C2 support for MD5/SHA-1/SHA-224/SHA-256/SHA-384/SHA-512
28 *
29 * @run main/othervm/timeout=600 -Xbatch
30 * -Dalgorithm=MD5
31 * compiler.intrinsics.sha.TestDigest
32 * @run main/othervm/timeout=600 -Xbatch
33 * -Dalgorithm=SHA-1
34 * compiler.intrinsics.sha.TestDigest
35 * @run main/othervm/timeout=600 -Xbatch
36 * -Dalgorithm=SHA-224
37 * compiler.intrinsics.sha.TestDigest
38 * @run main/othervm/timeout=600 -Xbatch
39 * -Dalgorithm=SHA-256
40 * compiler.intrinsics.sha.TestDigest
41 * @run main/othervm/timeout=600 -Xbatch
42 * -Dalgorithm=SHA-384
43 * compiler.intrinsics.sha.TestDigest
44 * @run main/othervm/timeout=600 -Xbatch
45 * -Dalgorithm=SHA-512
46 * compiler.intrinsics.sha.TestDigest
47 *
48 * @run main/othervm/timeout=600 -Xbatch
49 * -Dalgorithm=MD5 -Doffset=1
50 * compiler.intrinsics.sha.TestDigest
51 * @run main/othervm/timeout=600 -Xbatch
52 * -Dalgorithm=SHA-1 -Doffset=1
53 * compiler.intrinsics.sha.TestDigest
54 * @run main/othervm/timeout=600 -Xbatch
55 * -Dalgorithm=SHA-224 -Doffset=1
56 * compiler.intrinsics.sha.TestDigest
57 * @run main/othervm/timeout=600 -Xbatch
58 * -Dalgorithm=SHA-256 -Doffset=1
59 * compiler.intrinsics.sha.TestDigest
60 * @run main/othervm/timeout=600 -Xbatch
61 * -Dalgorithm=SHA-384 -Doffset=1
62 * compiler.intrinsics.sha.TestDigest
63 * @run main/othervm/timeout=600 -Xbatch
64 * -Dalgorithm=SHA-512 -Doffset=1
65 * compiler.intrinsics.sha.TestDigest
66 *
67 * @run main/othervm/timeout=600 -Xbatch
68 * -Dalgorithm=SHA-1 -Dalgorithm2=SHA-256
69 * compiler.intrinsics.sha.TestDigest
70 * @run main/othervm/timeout=600 -Xbatch
71 * -Dalgorithm=SHA-1 -Dalgorithm2=SHA-512
72 * compiler.intrinsics.sha.TestDigest
73 * @run main/othervm/timeout=600 -Xbatch
74 * -Dalgorithm=SHA-256 -Dalgorithm2=SHA-512
75 * compiler.intrinsics.sha.TestDigest
76 *
77 * @run main/othervm/timeout=600 -Xbatch
78 * -Dalgorithm=SHA-1 -Dalgorithm2=MD5
79 * compiler.intrinsics.sha.TestDigest
80 * @run main/othervm/timeout=600 -Xbatch
81 * -Dalgorithm=MD5 -Dalgorithm2=SHA-1
82 * compiler.intrinsics.sha.TestDigest
83 */
84
85 package compiler.intrinsics.sha;
86
87 import java.security.MessageDigest;
88 import java.util.Arrays;
89
90 public class TestDigest {
91 private static final int HASH_LEN = 64; /* up to 512-bit */
92 private static final int ALIGN = 8; /* for different data alignments */
93
94 public static void main(String[] args) throws Exception {
95 String provider = System.getProperty("provider", "SUN");
96 String algorithm = System.getProperty("algorithm", "SHA-1");
97 String algorithm2 = System.getProperty("algorithm2", "");
98 int msgSize = Integer.getInteger("msgSize", 1024);
99 int offset = Integer.getInteger("offset", 0) % ALIGN;
100 int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 100000);
101 int warmupIters = (args.length > 1 ? Integer.valueOf(args[1]) : 20000);
|
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @bug 8035968
27 * @summary C2 support for MD5/SHA-1/SHA-224/SHA-256/SHA-384/SHA-512/SHA3
28 *
29 * @run main/othervm/timeout=600 -Xbatch
30 * -Dalgorithm=MD5
31 * compiler.intrinsics.sha.TestDigest
32 * @run main/othervm/timeout=600 -Xbatch
33 * -Dalgorithm=SHA-1
34 * compiler.intrinsics.sha.TestDigest
35 * @run main/othervm/timeout=600 -Xbatch
36 * -Dalgorithm=SHA-224
37 * compiler.intrinsics.sha.TestDigest
38 * @run main/othervm/timeout=600 -Xbatch
39 * -Dalgorithm=SHA-256
40 * compiler.intrinsics.sha.TestDigest
41 * @run main/othervm/timeout=600 -Xbatch
42 * -Dalgorithm=SHA-384
43 * compiler.intrinsics.sha.TestDigest
44 * @run main/othervm/timeout=600 -Xbatch
45 * -Dalgorithm=SHA-512
46 * compiler.intrinsics.sha.TestDigest
47 * @run main/othervm/timeout=600 -Xbatch
48 * -Dalgorithm=SHA3-224
49 * compiler.intrinsics.sha.TestDigest
50 * @run main/othervm/timeout=600 -Xbatch
51 * -Dalgorithm=SHA3-256
52 * compiler.intrinsics.sha.TestDigest
53 * @run main/othervm/timeout=600 -Xbatch
54 * -Dalgorithm=SHA3-384
55 * compiler.intrinsics.sha.TestDigest
56 * @run main/othervm/timeout=600 -Xbatch
57 * -Dalgorithm=SHA3-512
58 * compiler.intrinsics.sha.TestDigest
59 *
60 * @run main/othervm/timeout=600 -Xbatch
61 * -Dalgorithm=MD5 -Doffset=1
62 * compiler.intrinsics.sha.TestDigest
63 * @run main/othervm/timeout=600 -Xbatch
64 * -Dalgorithm=SHA-1 -Doffset=1
65 * compiler.intrinsics.sha.TestDigest
66 * @run main/othervm/timeout=600 -Xbatch
67 * -Dalgorithm=SHA-224 -Doffset=1
68 * compiler.intrinsics.sha.TestDigest
69 * @run main/othervm/timeout=600 -Xbatch
70 * -Dalgorithm=SHA-256 -Doffset=1
71 * compiler.intrinsics.sha.TestDigest
72 * @run main/othervm/timeout=600 -Xbatch
73 * -Dalgorithm=SHA-384 -Doffset=1
74 * compiler.intrinsics.sha.TestDigest
75 * @run main/othervm/timeout=600 -Xbatch
76 * -Dalgorithm=SHA-512 -Doffset=1
77 * compiler.intrinsics.sha.TestDigest
78 * @run main/othervm/timeout=600 -Xbatch
79 * -Dalgorithm=SHA3-224 -Doffset=1
80 * compiler.intrinsics.sha.TestDigest
81 * @run main/othervm/timeout=600 -Xbatch
82 * -Dalgorithm=SHA3-256 -Doffset=1
83 * compiler.intrinsics.sha.TestDigest
84 * @run main/othervm/timeout=600 -Xbatch
85 * -Dalgorithm=SHA3-384 -Doffset=1
86 * compiler.intrinsics.sha.TestDigest
87 * @run main/othervm/timeout=600 -Xbatch
88 * -Dalgorithm=SHA3-512 -Doffset=1
89 * compiler.intrinsics.sha.TestDigest
90 *
91 * @run main/othervm/timeout=600 -Xbatch
92 * -Dalgorithm=SHA-1 -Dalgorithm2=SHA-256
93 * compiler.intrinsics.sha.TestDigest
94 * @run main/othervm/timeout=600 -Xbatch
95 * -Dalgorithm=SHA-1 -Dalgorithm2=SHA-512
96 * compiler.intrinsics.sha.TestDigest
97 * @run main/othervm/timeout=600 -Xbatch
98 * -Dalgorithm=SHA-256 -Dalgorithm2=SHA-512
99 * compiler.intrinsics.sha.TestDigest
100 *
101 * @run main/othervm/timeout=600 -Xbatch
102 * -Dalgorithm=SHA-1 -Dalgorithm2=MD5
103 * compiler.intrinsics.sha.TestDigest
104 * @run main/othervm/timeout=600 -Xbatch
105 * -Dalgorithm=MD5 -Dalgorithm2=SHA-1
106 * compiler.intrinsics.sha.TestDigest
107 *
108 * @run main/othervm/timeout=600 -Xbatch
109 * -Dalgorithm=SHA-1 -Dalgorithm2=SHA3-224
110 * compiler.intrinsics.sha.TestDigest
111 * @run main/othervm/timeout=600 -Xbatch
112 * -Dalgorithm=SHA-1 -Dalgorithm2=SHA3-256
113 * compiler.intrinsics.sha.TestDigest
114 * @run main/othervm/timeout=600 -Xbatch
115 * -Dalgorithm=SHA-1 -Dalgorithm2=SHA3-384
116 * compiler.intrinsics.sha.TestDigest
117 * @run main/othervm/timeout=600 -Xbatch
118 * -Dalgorithm=SHA-1 -Dalgorithm2=SHA3-512
119 * compiler.intrinsics.sha.TestDigest
120 * @run main/othervm/timeout=600 -Xbatch
121 * -Dalgorithm=SHA3-224 -Dalgorithm2=SHA-1
122 * compiler.intrinsics.sha.TestDigest
123 * @run main/othervm/timeout=600 -Xbatch
124 * -Dalgorithm=SHA3-256 -Dalgorithm2=SHA-1
125 * compiler.intrinsics.sha.TestDigest
126 * @run main/othervm/timeout=600 -Xbatch
127 * -Dalgorithm=SHA3-384 -Dalgorithm2=SHA-1
128 * compiler.intrinsics.sha.TestDigest
129 * @run main/othervm/timeout=600 -Xbatch
130 * -Dalgorithm=SHA3-512 -Dalgorithm2=SHA-1
131 * compiler.intrinsics.sha.TestDigest
132 */
133
134 package compiler.intrinsics.sha;
135
136 import java.security.MessageDigest;
137 import java.util.Arrays;
138
139 public class TestDigest {
140 private static final int HASH_LEN = 64; /* up to 512-bit */
141 private static final int ALIGN = 8; /* for different data alignments */
142
143 public static void main(String[] args) throws Exception {
144 String provider = System.getProperty("provider", "SUN");
145 String algorithm = System.getProperty("algorithm", "SHA-1");
146 String algorithm2 = System.getProperty("algorithm2", "");
147 int msgSize = Integer.getInteger("msgSize", 1024);
148 int offset = Integer.getInteger("offset", 0) % ALIGN;
149 int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 100000);
150 int warmupIters = (args.length > 1 ? Integer.valueOf(args[1]) : 20000);
|