|
38 | 38 | import java.net.URL; |
39 | 39 | import java.net.URLClassLoader; |
40 | 40 | import java.net.UnknownHostException; |
41 | | -import java.nio.ByteBuffer; |
42 | 41 | import java.nio.charset.StandardCharsets; |
43 | 42 | import java.nio.file.CopyOption; |
44 | 43 | import java.nio.file.Files; |
|
50 | 49 | import java.nio.file.attribute.FileAttribute; |
51 | 50 | import java.nio.channels.SocketChannel; |
52 | 51 | import java.nio.file.attribute.PosixFilePermissions; |
53 | | -import java.security.MessageDigest; |
54 | | -import java.security.NoSuchAlgorithmException; |
55 | 52 | import java.util.ArrayList; |
56 | 53 | import java.util.Arrays; |
57 | 54 | import java.util.Collection; |
|
71 | 68 | import java.util.regex.Matcher; |
72 | 69 | import java.util.regex.Pattern; |
73 | 70 | import java.util.stream.Collectors; |
| 71 | +import java.util.zip.CRC32C; |
74 | 72 |
|
75 | 73 | import static java.lang.System.lineSeparator; |
76 | 74 | import static jdk.test.lib.Asserts.assertTrue; |
@@ -170,16 +168,11 @@ public final class Utils { |
170 | 168 | var v = Runtime.version(); |
171 | 169 | // promotable builds have build number, and it's greater than 0 |
172 | 170 | if (v.build().orElse(0) > 0) { |
173 | | - // promotable build -> use 1st 8 bytes of md5($version) |
174 | | - try { |
175 | | - var md = MessageDigest.getInstance("MD5"); |
176 | | - var bytes = v.toString() |
177 | | - .getBytes(StandardCharsets.UTF_8); |
178 | | - bytes = md.digest(bytes); |
179 | | - SEED = ByteBuffer.wrap(bytes).getLong(); |
180 | | - } catch (NoSuchAlgorithmException e) { |
181 | | - throw new Error(e); |
182 | | - } |
| 171 | + // promotable build -> generate a seed based on the version string |
| 172 | + var bytes = v.toString().getBytes(StandardCharsets.UTF_8); |
| 173 | + var crc = new CRC32C(); |
| 174 | + crc.update(bytes); |
| 175 | + SEED = crc.getValue(); |
183 | 176 | } else { |
184 | 177 | // "personal" build -> use random seed |
185 | 178 | SEED = new Random().nextLong(); |
|
0 commit comments